From f81460273dc4b997071308598ab70b2fb73940f2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 7 May 2025 14:47:19 +0000 Subject: [PATCH] CodeGen from PR 34174 in Azure/azure-rest-api-specs Merge 4ded3f25290c3e24b3c88eb1f9dd86a593bb9f25 into 532b1b8f4efdb960efce95c6694164303d79a3fc --- .../azure-mgmt-cognitiveservices/CHANGELOG.md | 78 + .../azure-mgmt-cognitiveservices/README.md | 6 +- .../azure-mgmt-cognitiveservices/_meta.json | 6 +- .../azure/mgmt/cognitiveservices/__init__.py | 12 +- .../_cognitive_services_management_client.py | 61 +- .../mgmt/cognitiveservices/_configuration.py | 5 +- .../mgmt/cognitiveservices/_utils/__init__.py | 6 + .../serialization.py} | 566 +-- .../{_vendor.py => _utils/utils.py} | 17 +- .../azure/mgmt/cognitiveservices/_version.py | 2 +- .../mgmt/cognitiveservices/aio/__init__.py | 12 +- .../_cognitive_services_management_client.py | 63 +- .../cognitiveservices/aio/_configuration.py | 5 +- .../mgmt/cognitiveservices/aio/_vendor.py | 26 - .../aio/operations/__init__.py | 63 +- .../_account_capability_hosts_operations.py | 476 +++ .../_account_connections_operations.py | 592 +++ .../aio/operations/_accounts_operations.py | 45 +- ...e_services_management_client_operations.py | 22 +- .../_commitment_plans_operations.py | 51 +- .../_commitment_tiers_operations.py | 24 +- .../_defender_for_ai_settings_operations.py | 30 +- .../_deleted_accounts_operations.py | 28 +- .../aio/operations/_deployments_operations.py | 34 +- .../_encryption_scopes_operations.py | 30 +- ...ation_based_model_capacities_operations.py | 24 +- .../_model_capacities_operations.py | 24 +- .../aio/operations/_models_operations.py | 24 +- ...ity_perimeter_configurations_operations.py | 29 +- .../aio/operations/_operations.py | 24 +- ...private_endpoint_connections_operations.py | 30 +- .../_private_link_resources_operations.py | 24 +- .../_project_capability_hosts_operations.py | 495 +++ .../_project_connections_operations.py | 624 +++ .../aio/operations/_projects_operations.py | 734 ++++ .../_rai_blocklist_items_operations.py | 52 +- .../operations/_rai_blocklists_operations.py | 30 +- .../_rai_content_filters_operations.py | 26 +- .../operations/_rai_policies_operations.py | 30 +- .../operations/_resource_skus_operations.py | 24 +- .../aio/operations/_usages_operations.py | 24 +- .../mgmt/cognitiveservices/models/__init__.py | 417 +- ...nitive_services_management_client_enums.py | 184 +- .../cognitiveservices/models/_models_py3.py | 3457 +++++++++++++++-- .../cognitiveservices/operations/__init__.py | 63 +- .../_account_capability_hosts_operations.py | 591 +++ .../_account_connections_operations.py | 795 ++++ .../operations/_accounts_operations.py | 88 +- ...e_services_management_client_operations.py | 36 +- .../_commitment_plans_operations.py | 108 +- .../_commitment_tiers_operations.py | 29 +- .../_defender_for_ai_settings_operations.py | 48 +- .../_deleted_accounts_operations.py | 42 +- .../operations/_deployments_operations.py | 60 +- .../_encryption_scopes_operations.py | 48 +- ...ation_based_model_capacities_operations.py | 29 +- .../_model_capacities_operations.py | 29 +- .../operations/_models_operations.py | 29 +- ...ity_perimeter_configurations_operations.py | 42 +- .../operations/_operations.py | 27 +- ...private_endpoint_connections_operations.py | 48 +- .../_private_link_resources_operations.py | 30 +- .../_project_capability_hosts_operations.py | 634 +++ .../_project_connections_operations.py | 861 ++++ .../operations/_projects_operations.py | 913 +++++ .../_rai_blocklist_items_operations.py | 62 +- .../operations/_rai_blocklists_operations.py | 48 +- .../_rai_content_filters_operations.py | 36 +- .../operations/_rai_policies_operations.py | 48 +- .../operations/_resource_skus_operations.py | 27 +- .../operations/_usages_operations.py | 29 +- .../create_or_update.py | 49 + .../account_capability_host/delete.py | 43 + .../account_capability_host/get.py | 44 + .../account_connection/create.py | 44 + .../account_connection/delete.py | 43 + .../account_connection/get.py | 44 + .../account_connection/list.py | 44 + .../account_connection/update.py | 44 + .../add_rai_blocklist_items.py | 3 +- .../calculate_model_capacity.py | 5 +- .../generated_samples/create_account.py | 7 +- .../generated_samples/create_account_min.py | 5 +- .../generated_samples/create_project.py | 49 + .../generated_samples/create_project_min.py | 45 + .../create_shared_commitment_plan.py | 5 +- ...eate_shared_commitment_plan_association.py | 5 +- .../generated_samples/delete_account.py | 5 +- .../delete_commitment_plan.py | 5 +- .../generated_samples/delete_deployment.py | 5 +- .../delete_encryption_scope.py | 3 +- .../delete_private_endpoint_connection.py | 5 +- .../generated_samples/delete_project.py | 43 + .../generated_samples/delete_rai_blocklist.py | 3 +- .../delete_rai_blocklist_item.py | 3 +- .../delete_rai_blocklist_items.py | 3 +- .../generated_samples/delete_rai_policy.py | 3 +- .../delete_shared_commitment_plan.py | 5 +- ...lete_shared_commitment_plan_association.py | 5 +- .../generated_samples/get_account.py | 5 +- .../generated_samples/get_commitment_plan.py | 5 +- .../get_defender_for_ai_setting.py | 3 +- .../generated_samples/get_deleted_account.py | 5 +- .../generated_samples/get_deployment.py | 5 +- .../generated_samples/get_encryption_scope.py | 3 +- ...twork_security_perimeter_configurations.py | 3 +- .../generated_samples/get_operations.py | 3 +- .../get_private_endpoint_connection.py | 5 +- .../generated_samples/get_project.py | 44 + .../generated_samples/get_rai_blocklist.py | 3 +- .../get_rai_blocklist_item.py | 3 +- .../get_rai_content_filter.py | 3 +- .../generated_samples/get_rai_policy.py | 3 +- .../get_shared_commitment_plan.py | 5 +- .../get_shared_commitment_plan_association.py | 5 +- .../generated_samples/get_skus.py | 3 +- .../generated_samples/get_usages.py | 3 +- .../generated_samples/list_account_models.py | 5 +- .../list_accounts_by_resource_group.py | 5 +- .../list_accounts_by_subscription.py | 5 +- .../generated_samples/list_blocklist_items.py | 3 +- .../generated_samples/list_blocklists.py | 3 +- .../list_commitment_plans.py | 5 +- .../list_commitment_tiers.py | 5 +- .../list_defender_for_ai_setting.py | 3 +- .../list_deleted_accounts_by_subscription.py | 5 +- .../generated_samples/list_deployment_skus.py | 3 +- .../generated_samples/list_deployments.py | 5 +- .../list_encryption_scopes.py | 3 +- .../generated_samples/list_keys.py | 5 +- .../list_location_based_model_capacities.py | 3 +- .../generated_samples/list_location_models.py | 3 +- .../list_model_capacities.py | 3 +- ...twork_security_perimeter_configurations.py | 3 +- .../list_private_endpoint_connections.py | 5 +- .../list_private_link_resources.py | 5 +- .../generated_samples/list_projects.py | 44 + .../list_rai_content_filters.py | 3 +- .../generated_samples/list_rai_policies.py | 3 +- ...ist_shared_commitment_plan_associations.py | 5 +- ...ared_commitment_plans_by_resource_group.py | 5 +- ...shared_commitment_plans_by_subscription.py | 5 +- .../generated_samples/list_skus.py | 5 +- .../generated_samples/list_usages.py | 3 +- .../create_or_update.py | 50 + .../project_capability_host/delete.py | 44 + .../project_capability_host/get.py | 45 + .../project_connection/create.py | 45 + .../project_connection/delete.py | 44 + .../project_connection/get.py | 45 + .../project_connection/list.py | 45 + .../project_connection/update.py | 45 + .../purge_deleted_account.py | 5 +- .../generated_samples/put_commitment_plan.py | 5 +- .../generated_samples/put_deployment.py | 5 +- .../generated_samples/put_encryption_scope.py | 3 +- .../put_private_endpoint_connection.py | 5 +- .../generated_samples/put_rai_blocklist.py | 3 +- .../put_rai_blocklist_item.py | 3 +- .../generated_samples/put_rai_policy.py | 3 +- ...twork_security_perimeter_configurations.py | 3 +- .../generated_samples/update_account.py | 5 +- .../generated_samples/update_deployment.py | 3 +- .../generated_samples/update_projects.py | 45 + .../update_shared_commitment_plan.py | 5 +- .../generated_tests/conftest.py | 2 +- .../test_cognitive_services_management.py | 6 +- ...ent_account_capability_hosts_operations.py | 74 + ...count_capability_hosts_operations_async.py | 79 + ...nagement_account_connections_operations.py | 83 + ...nt_account_connections_operations_async.py | 84 + ...services_management_accounts_operations.py | 52 +- ...es_management_accounts_operations_async.py | 60 +- ...est_cognitive_services_management_async.py | 6 +- ..._management_commitment_plans_operations.py | 56 +- ...ement_commitment_plans_operations_async.py | 56 +- ..._management_commitment_tiers_operations.py | 4 +- ...ement_commitment_tiers_operations_async.py | 4 +- ...ent_defender_for_ai_settings_operations.py | 16 +- ...fender_for_ai_settings_operations_async.py | 16 +- ..._management_deleted_accounts_operations.py | 12 +- ...ement_deleted_accounts_operations_async.py | 12 +- ...vices_management_deployments_operations.py | 25 +- ...management_deployments_operations_async.py | 25 +- ...management_encryption_scopes_operations.py | 16 +- ...ment_encryption_scopes_operations_async.py | 16 +- ...ation_based_model_capacities_operations.py | 4 +- ...based_model_capacities_operations_async.py | 4 +- ..._management_model_capacities_operations.py | 4 +- ...ement_model_capacities_operations_async.py | 4 +- ...e_services_management_models_operations.py | 4 +- ...ices_management_models_operations_async.py | 4 +- ...ity_perimeter_configurations_operations.py | 12 +- ...rimeter_configurations_operations_async.py | 12 +- ...ognitive_services_management_operations.py | 4 +- ...ve_services_management_operations_async.py | 4 +- ...private_endpoint_connections_operations.py | 16 +- ...e_endpoint_connections_operations_async.py | 16 +- ...ement_private_link_resources_operations.py | 4 +- ...private_link_resources_operations_async.py | 4 +- ...ent_project_capability_hosts_operations.py | 77 + ...oject_capability_hosts_operations_async.py | 82 + ...nagement_project_connections_operations.py | 88 + ...nt_project_connections_operations_async.py | 89 + ...services_management_projects_operations.py | 141 + ...es_management_projects_operations_async.py | 148 + ...nagement_rai_blocklist_items_operations.py | 24 +- ...nt_rai_blocklist_items_operations_async.py | 24 +- ...es_management_rai_blocklists_operations.py | 16 +- ...agement_rai_blocklists_operations_async.py | 16 +- ...nagement_rai_content_filters_operations.py | 8 +- ...nt_rai_content_filters_operations_async.py | 8 +- ...ices_management_rai_policies_operations.py | 16 +- ...anagement_rai_policies_operations_async.py | 16 +- ...ces_management_resource_skus_operations.py | 4 +- ...nagement_resource_skus_operations_async.py | 4 +- ...e_services_management_usages_operations.py | 4 +- ...ices_management_usages_operations_async.py | 4 +- .../azure-mgmt-cognitiveservices/setup.py | 13 +- 219 files changed, 14163 insertions(+), 2037 deletions(-) create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/__init__.py rename sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/{_serialization.py => _utils/serialization.py} (83%) rename sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/{_vendor.py => _utils/utils.py} (58%) delete mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_vendor.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_capability_hosts_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_connections_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_capability_hosts_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_connections_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_projects_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_capability_hosts_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_connections_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_capability_hosts_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_connections_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_projects_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/create_or_update.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/delete.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/get.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/create.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/delete.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/get.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/list.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/update.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/create_or_update.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/delete.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/get.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/create.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/delete.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/get.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/list.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/update.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations_async.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connections_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connections_operations_async.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations_async.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connections_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connections_operations_async.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations.py create mode 100644 sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations_async.py diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md index da0153c8214c..1bc63ed1341c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/CHANGELOG.md @@ -1,5 +1,83 @@ # Release History +## 13.7.0 (2025-05-07) + +### Features Added + + - Client `CognitiveServicesManagementClient` added operation group `projects` + - Client `CognitiveServicesManagementClient` added operation group `account_connections` + - Client `CognitiveServicesManagementClient` added operation group `project_connections` + - Client `CognitiveServicesManagementClient` added operation group `account_capability_hosts` + - Client `CognitiveServicesManagementClient` added operation group `project_capability_hosts` + - Model `AccountProperties` added property `network_injections` + - Model `AccountProperties` added property `allow_project_management` + - Model `AccountProperties` added property `default_project` + - Model `AccountProperties` added property `associated_projects` + - Model `DeploymentProperties` added property `spillover_deployment_name` + - Enum `ProvisioningState` added member `CANCELED` + - Added model `AADAuthTypeConnectionProperties` + - Added model `AccessKeyAuthTypeConnectionProperties` + - Added model `AccountKeyAuthTypeConnectionProperties` + - Added model `ApiKeyAuthConnectionProperties` + - Added model `CapabilityHost` + - Added enum `CapabilityHostKind` + - Added model `CapabilityHostProperties` + - Added enum `CapabilityHostProvisioningState` + - Added model `ConnectionAccessKey` + - Added model `ConnectionAccountKey` + - Added model `ConnectionApiKey` + - Added enum `ConnectionAuthType` + - Added enum `ConnectionCategory` + - Added enum `ConnectionGroup` + - Added model `ConnectionManagedIdentity` + - Added model `ConnectionOAuth2` + - Added model `ConnectionPersonalAccessToken` + - Added model `ConnectionPropertiesV2` + - Added model `ConnectionPropertiesV2BasicResource` + - Added model `ConnectionPropertiesV2BasicResourceArmPaginatedResult` + - Added model `ConnectionServicePrincipal` + - Added model `ConnectionSharedAccessSignature` + - Added model `ConnectionUpdateContent` + - Added model `ConnectionUsernamePassword` + - Added model `CustomKeys` + - Added model `CustomKeysConnectionProperties` + - Added model `ManagedIdentityAuthTypeConnectionProperties` + - Added enum `ManagedPERequirement` + - Added enum `ManagedPEStatus` + - Added model `NetworkInjections` + - Added model `NoneAuthTypeConnectionProperties` + - Added model `OAuth2AuthTypeConnectionProperties` + - Added model `PATAuthTypeConnectionProperties` + - Added model `Project` + - Added model `ProjectListResult` + - Added model `ProjectProperties` + - Added model `ResourceBase` + - Added model `SASAuthTypeConnectionProperties` + - Added enum `ScenarioType` + - Added model `ServicePrincipalAuthTypeConnectionProperties` + - Added model `UsernamePasswordAuthTypeConnectionProperties` + - Added model `AccountCapabilityHostsOperations` + - Added model `AccountConnectionsOperations` + - Added model `ProjectCapabilityHostsOperations` + - Added model `ProjectConnectionsOperations` + - Added model `ProjectsOperations` + - Method `AccountCapabilityHostsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, account_name: str, capability_host_name: str, capability_host: CapabilityHost, content_type: str)` + - Method `AccountCapabilityHostsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, account_name: str, capability_host_name: str, capability_host: IO[bytes], content_type: str)` + - Method `AccountConnectionsOperations.create` has a new overload `def create(self: None, resource_group_name: str, account_name: str, connection_name: str, connection: Optional[ConnectionPropertiesV2BasicResource], content_type: str)` + - Method `AccountConnectionsOperations.create` has a new overload `def create(self: None, resource_group_name: str, account_name: str, connection_name: str, connection: Optional[IO[bytes]], content_type: str)` + - Method `AccountConnectionsOperations.update` has a new overload `def update(self: None, resource_group_name: str, account_name: str, connection_name: str, connection: Optional[ConnectionUpdateContent], content_type: str)` + - Method `AccountConnectionsOperations.update` has a new overload `def update(self: None, resource_group_name: str, account_name: str, connection_name: str, connection: Optional[IO[bytes]], content_type: str)` + - Method `ProjectCapabilityHostsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, capability_host: CapabilityHost, content_type: str)` + - Method `ProjectCapabilityHostsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, capability_host: IO[bytes], content_type: str)` + - Method `ProjectConnectionsOperations.create` has a new overload `def create(self: None, resource_group_name: str, account_name: str, project_name: str, connection_name: str, connection: Optional[ConnectionPropertiesV2BasicResource], content_type: str)` + - Method `ProjectConnectionsOperations.create` has a new overload `def create(self: None, resource_group_name: str, account_name: str, project_name: str, connection_name: str, connection: Optional[IO[bytes]], content_type: str)` + - Method `ProjectConnectionsOperations.update` has a new overload `def update(self: None, resource_group_name: str, account_name: str, project_name: str, connection_name: str, connection: Optional[ConnectionUpdateContent], content_type: str)` + - Method `ProjectConnectionsOperations.update` has a new overload `def update(self: None, resource_group_name: str, account_name: str, project_name: str, connection_name: str, connection: Optional[IO[bytes]], content_type: str)` + - Method `ProjectsOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, account_name: str, project_name: str, project: Project, content_type: str)` + - Method `ProjectsOperations.begin_create` has a new overload `def begin_create(self: None, resource_group_name: str, account_name: str, project_name: str, project: IO[bytes], content_type: str)` + - Method `ProjectsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, account_name: str, project_name: str, project: Project, content_type: str)` + - Method `ProjectsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, account_name: str, project_name: str, project: IO[bytes], content_type: str)` + ## 13.6.0 (2024-12-19) ### Features Added diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/README.md index da310df8a0f8..b9e2907e36c8 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.8+. +This package has been tested with Python 3.9+. 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.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json index cdaa7a9724c7..29ee0e35d3ef 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/_meta.json @@ -1,11 +1,11 @@ { - "commit": "0383d4a163beb3e58e7b4cb3c06172d32ddd8c85", + "commit": "ff480b008f17e213d1831a68b84fbe795abfa69d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.19.0", + "@autorest/python@6.34.1", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/cognitiveservices/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/cognitiveservices/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/__init__.py index 534cb95c3a3f..cf2ee8a715df 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._cognitive_services_management_client import CognitiveServicesManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._cognitive_services_management_client import CognitiveServicesManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "CognitiveServicesManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__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/_cognitive_services_management_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py index a1f1c2283335..4784c7190a08 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_cognitive_services_management_client.py @@ -7,18 +7,22 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +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 +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import CognitiveServicesManagementClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( + AccountCapabilityHostsOperations, + AccountConnectionsOperations, AccountsOperations, CognitiveServicesManagementClientOperationsMixin, CommitmentPlansOperations, @@ -34,6 +38,9 @@ Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, + ProjectCapabilityHostsOperations, + ProjectConnectionsOperations, + ProjectsOperations, RaiBlocklistItemsOperations, RaiBlocklistsOperations, RaiContentFiltersOperations, @@ -43,13 +50,12 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential class CognitiveServicesManagementClient( CognitiveServicesManagementClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +): # pylint: disable=too-many-instance-attributes """Cognitive Services Management Client. :ivar accounts: AccountsOperations operations @@ -100,13 +106,27 @@ class CognitiveServicesManagementClient( :ivar defender_for_ai_settings: DefenderForAISettingsOperations operations :vartype defender_for_ai_settings: azure.mgmt.cognitiveservices.operations.DefenderForAISettingsOperations + :ivar projects: ProjectsOperations operations + :vartype projects: azure.mgmt.cognitiveservices.operations.ProjectsOperations + :ivar account_connections: AccountConnectionsOperations operations + :vartype account_connections: + azure.mgmt.cognitiveservices.operations.AccountConnectionsOperations + :ivar project_connections: ProjectConnectionsOperations operations + :vartype project_connections: + azure.mgmt.cognitiveservices.operations.ProjectConnectionsOperations + :ivar account_capability_hosts: AccountCapabilityHostsOperations operations + :vartype account_capability_hosts: + azure.mgmt.cognitiveservices.operations.AccountCapabilityHostsOperations + :ivar project_capability_hosts: ProjectCapabilityHostsOperations operations + :vartype project_capability_hosts: + azure.mgmt.cognitiveservices.operations.ProjectCapabilityHostsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2025-06-01". 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 @@ -114,15 +134,17 @@ class CognitiveServicesManagementClient( """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = CognitiveServicesManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -141,7 +163,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -191,6 +213,19 @@ def __init__( self.defender_for_ai_settings = DefenderForAISettingsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.projects = ProjectsOperations(self._client, self._config, self._serialize, self._deserialize) + self.account_connections = AccountConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.project_connections = ProjectConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.account_capability_hosts = AccountCapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.project_capability_hosts = ProjectCapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. 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 fe5d779db3a0..7eee67513a1c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_configuration.py @@ -14,7 +14,6 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -28,13 +27,13 @@ class CognitiveServicesManagementClientConfiguration: # pylint: disable=too-man :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2025-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-10-01") + api_version: str = kwargs.pop("api_version", "2025-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/__init__.py new file mode 100644 index 000000000000..0af9b28f6607 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/__init__.py @@ -0,0 +1,6 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/serialization.py similarity index 83% rename from sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py rename to sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/serialization.py index 8139854b97bb..f5187701d7be 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_serialization.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -48,11 +30,8 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, - Mapping, ) try: @@ -62,13 +41,13 @@ 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 _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +70,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +93,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +136,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -179,80 +165,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +244,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +280,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,7 +304,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -380,12 +340,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,30 +358,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -426,9 +390,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +414,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +471,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +512,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +532,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +567,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +610,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +642,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +681,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,11 +690,13 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -728,21 +708,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +738,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +760,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +784,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +800,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +819,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +852,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +862,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +923,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +948,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +956,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +981,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1012,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1074,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1089,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1127,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1159,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,11 +1174,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1211,7 +1199,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1222,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1333,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1354,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1364,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1401,27 +1402,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1443,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1479,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1507,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1520,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1535,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1558,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1587,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1624,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1647,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1671,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1695,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,13 +1706,14 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1720,11 +1746,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,8 +1757,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1743,24 +1769,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1768,6 +1793,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1807,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1819,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1830,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,8 +1848,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1834,8 +1861,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1849,8 +1877,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,8 +1894,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1877,8 +1907,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1887,16 +1918,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1910,8 +1941,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1924,31 +1956,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1976,8 +2009,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,8 +2017,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1996,5 +2029,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/utils.py similarity index 58% rename from sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py rename to sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/utils.py index d064dd73a618..39b612f39a9b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_vendor.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/_utils/utils.py @@ -6,21 +6,20 @@ # -------------------------------------------------------------------------- from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import CognitiveServicesManagementClientConfiguration +from typing import Generic, TYPE_CHECKING, TypeVar if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import PipelineClient + from .serialization import Deserializer, Serializer + - from ._serialization import Deserializer, Serializer +TClient = TypeVar("TClient") +TConfig = TypeVar("TConfig") -class CognitiveServicesManagementClientMixinABC(ABC): # pylint: disable=name-too-long +class ClientMixinABC(ABC, Generic[TClient, TConfig]): """DO NOT use this class. It is for internal typing use only.""" - _client: "PipelineClient" - _config: CognitiveServicesManagementClientConfiguration + _client: TClient + _config: TConfig _serialize: "Serializer" _deserialize: "Deserializer" 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 1e5104a3d415..0eb0376778d0 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 = "13.6.0" +VERSION = "13.7.0" diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/__init__.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/__init__.py index 2e952442ec90..7ac2db0cdcfd 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/__init__.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._cognitive_services_management_client import CognitiveServicesManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._cognitive_services_management_client import CognitiveServicesManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "CognitiveServicesManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__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/aio/_cognitive_services_management_client.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py index 78ef2a21910e..a902ff3d3e6c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_cognitive_services_management_client.py @@ -7,18 +7,22 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +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 +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import CognitiveServicesManagementClientConfiguration from .operations import ( + AccountCapabilityHostsOperations, + AccountConnectionsOperations, AccountsOperations, CognitiveServicesManagementClientOperationsMixin, CommitmentPlansOperations, @@ -34,6 +38,9 @@ Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, + ProjectCapabilityHostsOperations, + ProjectConnectionsOperations, + ProjectsOperations, RaiBlocklistItemsOperations, RaiBlocklistsOperations, RaiContentFiltersOperations, @@ -43,13 +50,12 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential class CognitiveServicesManagementClient( CognitiveServicesManagementClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +): # pylint: disable=too-many-instance-attributes """Cognitive Services Management Client. :ivar accounts: AccountsOperations operations @@ -105,13 +111,27 @@ class CognitiveServicesManagementClient( :ivar defender_for_ai_settings: DefenderForAISettingsOperations operations :vartype defender_for_ai_settings: azure.mgmt.cognitiveservices.aio.operations.DefenderForAISettingsOperations + :ivar projects: ProjectsOperations operations + :vartype projects: azure.mgmt.cognitiveservices.aio.operations.ProjectsOperations + :ivar account_connections: AccountConnectionsOperations operations + :vartype account_connections: + azure.mgmt.cognitiveservices.aio.operations.AccountConnectionsOperations + :ivar project_connections: ProjectConnectionsOperations operations + :vartype project_connections: + azure.mgmt.cognitiveservices.aio.operations.ProjectConnectionsOperations + :ivar account_capability_hosts: AccountCapabilityHostsOperations operations + :vartype account_capability_hosts: + azure.mgmt.cognitiveservices.aio.operations.AccountCapabilityHostsOperations + :ivar project_capability_hosts: ProjectCapabilityHostsOperations operations + :vartype project_capability_hosts: + azure.mgmt.cognitiveservices.aio.operations.ProjectCapabilityHostsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2025-06-01". 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 @@ -119,15 +139,17 @@ class CognitiveServicesManagementClient( """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = CognitiveServicesManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -146,7 +168,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -196,6 +220,19 @@ def __init__( self.defender_for_ai_settings = DefenderForAISettingsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.projects = ProjectsOperations(self._client, self._config, self._serialize, self._deserialize) + self.account_connections = AccountConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.project_connections = ProjectConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.account_capability_hosts = AccountCapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.project_capability_hosts = ProjectCapabilityHostsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any 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 2ce4b4dddddf..bd0b9496aa88 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 @@ -14,7 +14,6 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -28,13 +27,13 @@ class CognitiveServicesManagementClientConfiguration: # pylint: disable=too-man :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-10-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2025-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-10-01") + api_version: str = kwargs.pop("api_version", "2025-06-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_vendor.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_vendor.py deleted file mode 100644 index 9d3c651db221..000000000000 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/_vendor.py +++ /dev/null @@ -1,26 +0,0 @@ -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from abc import ABC -from typing import TYPE_CHECKING - -from ._configuration import CognitiveServicesManagementClientConfiguration - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core import AsyncPipelineClient - - from .._serialization import Deserializer, Serializer - - -class CognitiveServicesManagementClientMixinABC(ABC): # pylint: disable=name-too-long - """DO NOT use this class. It is for internal typing use only.""" - - _client: "AsyncPipelineClient" - _config: CognitiveServicesManagementClientConfiguration - _serialize: "Serializer" - _deserialize: "Deserializer" 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 fdaa24c0f86a..e1205acdd6b3 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,31 +6,42 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._accounts_operations import AccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._resource_skus_operations import ResourceSkusOperations -from ._usages_operations import UsagesOperations -from ._operations import Operations -from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin -from ._commitment_tiers_operations import CommitmentTiersOperations -from ._models_operations import ModelsOperations -from ._location_based_model_capacities_operations import LocationBasedModelCapacitiesOperations -from ._model_capacities_operations import ModelCapacitiesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._deployments_operations import DeploymentsOperations -from ._commitment_plans_operations import CommitmentPlansOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._rai_policies_operations import RaiPoliciesOperations -from ._rai_blocklists_operations import RaiBlocklistsOperations -from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations -from ._rai_content_filters_operations import RaiContentFiltersOperations -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations -from ._defender_for_ai_settings_operations import DefenderForAISettingsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._accounts_operations import AccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._resource_skus_operations import ResourceSkusOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin # type: ignore +from ._commitment_tiers_operations import CommitmentTiersOperations # type: ignore +from ._models_operations import ModelsOperations # type: ignore +from ._location_based_model_capacities_operations import LocationBasedModelCapacitiesOperations # type: ignore +from ._model_capacities_operations import ModelCapacitiesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._deployments_operations import DeploymentsOperations # type: ignore +from ._commitment_plans_operations import CommitmentPlansOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._rai_policies_operations import RaiPoliciesOperations # type: ignore +from ._rai_blocklists_operations import RaiBlocklistsOperations # type: ignore +from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations # type: ignore +from ._rai_content_filters_operations import RaiContentFiltersOperations # type: ignore +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._defender_for_ai_settings_operations import DefenderForAISettingsOperations # type: ignore +from ._projects_operations import ProjectsOperations # type: ignore +from ._account_connections_operations import AccountConnectionsOperations # type: ignore +from ._project_connections_operations import ProjectConnectionsOperations # type: ignore +from ._account_capability_hosts_operations import AccountCapabilityHostsOperations # type: ignore +from ._project_capability_hosts_operations import ProjectCapabilityHostsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -54,6 +66,11 @@ "RaiContentFiltersOperations", "NetworkSecurityPerimeterConfigurationsOperations", "DefenderForAISettingsOperations", + "ProjectsOperations", + "AccountConnectionsOperations", + "ProjectConnectionsOperations", + "AccountCapabilityHostsOperations", + "ProjectCapabilityHostsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__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/aio/operations/_account_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_capability_hosts_operations.py new file mode 100644 index 000000000000..f2dd94b13309 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_capability_hosts_operations.py @@ -0,0 +1,476 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._account_capability_hosts_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) +from .._configuration import CognitiveServicesManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AccountCapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`account_capability_hosts` attribute. + """ + + models = _models + + 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") + + async def _delete_initial( + self, resource_group_name: str, account_name: str, capability_host_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete account capabilityHost. + + Delete account 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 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 AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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, + capability_host_name=capability_host_name, + api_version=api_version, + 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 + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **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_async + async def get( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """Get account capabilityHost. + + Get account 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 capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + capability_host: Union[_models.CapabilityHost, 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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" + _json = None + _content = None + if isinstance(capability_host, (IOBase, bytes)): + _content = capability_host + else: + _json = self._serialize.body(capability_host, "CapabilityHost") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, + capability_host_name: str, + capability_host: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account 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 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.CapabilityHost + :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 either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + capability_host: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account 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 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: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + capability_host: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account 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 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 either a CapabilityHost type or a + IO[bytes] type. Required. + :type capability_host: ~azure.mgmt.cognitiveservices.models.CapabilityHost or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapabilityHost] = 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, + capability_host_name=capability_host_name, + capability_host=capability_host, + api_version=api_version, + 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): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_connections_operations.py new file mode 100644 index 000000000000..d5a75259bf67 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_account_connections_operations.py @@ -0,0 +1,592 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._account_connections_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._configuration import CognitiveServicesManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class AccountConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`account_connections` attribute. + """ + + models = _models + + 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 + async def delete(self, resource_group_name: str, account_name: str, connection_name: str, **kwargs: Any) -> None: + """Delete Cognitive Services account connection by name. + + Delete Cognitive Services account 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 connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: None or the result of cls(response) + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, account_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Lists Cognitive Services account connection by name. + + Lists Cognitive Services account 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 connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[_models.ConnectionUpdateContent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified 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 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified 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 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionUpdateContent, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified 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 connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: Parameters for account connection update. Is either a + ConnectionUpdateContent type or a IO[bytes] type. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = 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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _json = self._serialize.body(connection, "ConnectionUpdateContent") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[_models.ConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified 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 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified 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 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified 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 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 either a + ConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = 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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _json = self._serialize.body(connection, "ConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> AsyncIterable["_models.ConnectionPropertiesV2BasicResource"]: + """Lists all the available Cognitive Services account connections under the specified account. + + Lists all the available Cognitive Services account connections under the specified 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 target: Target of the connection. Default value is None. + :type target: str + :param category: Category of the connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either ConnectionPropertiesV2BasicResource or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResourceArmPaginatedResult] = 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_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + target=target, + category=category, + include_all=include_all, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_accounts_operations.py index d3a2bb7e4b48..c900df96d2ee 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._accounts_operations import ( build_create_request, build_delete_request, @@ -45,11 +47,8 @@ build_regenerate_key_request, build_update_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,15 +67,17 @@ class AccountsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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") async def _create_initial( self, resource_group_name: str, account_name: str, account: Union[_models.Account, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -264,7 +265,7 @@ def get_long_running_output(pipeline_response): async def _update_initial( self, resource_group_name: str, account_name: str, account: Union[_models.Account, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -447,7 +448,7 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -561,7 +562,7 @@ async def get(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -621,7 +622,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -697,7 +698,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Account"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -771,7 +772,7 @@ async def list_keys(self, resource_group_name: str, account_name: str, **kwargs: :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -832,7 +833,7 @@ async def regenerate_key( :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -896,7 +897,7 @@ async def list_skus( :rtype: ~azure.mgmt.cognitiveservices.models.AccountSkuListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -958,7 +959,7 @@ async def list_usages( :rtype: ~azure.mgmt.cognitiveservices.models.UsageListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1024,7 +1025,7 @@ def list_models( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountModelListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_cognitive_services_management_client_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_cognitive_services_management_client_operations.py index e566a4959840..4005bb104945 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_cognitive_services_management_client_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_cognitive_services_management_client_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, List, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,23 +25,20 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.utils import ClientMixinABC from ...operations._cognitive_services_management_client_operations import ( build_calculate_model_capacity_request, build_check_domain_availability_request, build_check_sku_availability_request, ) -from .._vendor import CognitiveServicesManagementClientMixinABC +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class CognitiveServicesManagementClientOperationsMixin( # pylint: disable=name-too-long - CognitiveServicesManagementClientMixinABC + ClientMixinABC[AsyncPipelineClient, CognitiveServicesManagementClientConfiguration] ): @distributed_trace_async @@ -61,7 +59,7 @@ async def check_sku_availability( :rtype: ~azure.mgmt.cognitiveservices.models.SkuAvailabilityListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,7 +123,7 @@ async def check_domain_availability( :rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -192,7 +190,7 @@ async def calculate_model_capacity( :rtype: ~azure.mgmt.cognitiveservices.models.CalculateModelCapacityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py index ee9103a0dd8c..4e1f2b2c0e27 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_plans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._commitment_plans_operations import ( build_create_or_update_association_request, build_create_or_update_plan_request, @@ -48,11 +50,8 @@ build_list_request, build_update_plan_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,10 +70,12 @@ class CommitmentPlansOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list( @@ -98,7 +99,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -179,7 +180,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -311,7 +312,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -370,7 +371,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -485,7 +486,7 @@ async def _create_or_update_plan_initial( commitment_plan: Union[_models.CommitmentPlan, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,7 +685,7 @@ async def _update_plan_initial( commitment_plan: Union[_models.PatchResourceTagsAndSku, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -883,7 +884,7 @@ def get_long_running_output(pipeline_response): async def _delete_plan_initial( self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1009,7 +1010,7 @@ async def get_plan( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1072,7 +1073,7 @@ def list_plans_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1149,7 +1150,7 @@ def list_plans_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Co api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1234,7 +1235,7 @@ def list_associations( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanAccountAssociationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1316,7 +1317,7 @@ async def get_association( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1368,7 +1369,7 @@ async def _create_or_update_association_initial( association: Union[_models.CommitmentPlanAccountAssociation, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1581,7 +1582,7 @@ def get_long_running_output(pipeline_response): async def _delete_association_initial( self, resource_group_name: str, commitment_plan_name: str, commitment_plan_association_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py index f1f9faf98f1d..13aebd6962b9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_commitment_tiers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._commitment_tiers_operations import build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +48,12 @@ class CommitmentTiersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.CommitmentTier"]: @@ -72,7 +72,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Commitmen api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentTierListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_defender_for_ai_settings_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_defender_for_ai_settings_operations.py index 228da076938b..5f01f038eab0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_defender_for_ai_settings_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_defender_for_ai_settings_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,17 +28,15 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._defender_for_ai_settings_operations import ( build_create_or_update_request, build_get_request, build_list_request, build_update_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,10 +55,12 @@ class DefenderForAISettingsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list( @@ -85,7 +85,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DefenderForAISettingResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +165,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -295,7 +295,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +437,7 @@ async def update( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py index db5d37aca5c7..aca67e384962 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deleted_accounts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,12 +31,10 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._deleted_accounts_operations import build_get_request, build_list_request, build_purge_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -55,10 +53,12 @@ class DeletedAccountsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 async def get(self, location: str, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: @@ -75,7 +75,7 @@ async def get(self, location: str, resource_group_name: str, account_name: str, :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -122,7 +122,7 @@ async def get(self, location: str, resource_group_name: str, account_name: str, async def _purge_initial( self, location: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -243,7 +243,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Account"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py index c6b90b7b0bc8..13fece7dbf4e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_deployments_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._deployments_operations import ( build_create_or_update_request, build_delete_request, @@ -40,11 +41,8 @@ build_list_skus_request, build_update_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,10 +61,12 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterable["_models.Deployment"]: @@ -88,7 +88,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +221,7 @@ async def _create_or_update_initial( deployment: Union[_models.Deployment, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -432,7 +432,7 @@ async def _update_initial( deployment: Union[_models.PatchResourceTagsAndSku, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +641,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -774,7 +774,7 @@ def list_skus( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeploymentSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py index 08428d59d993..eac623894b28 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_encryption_scopes_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,17 +32,15 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._encryption_scopes_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,10 +59,12 @@ class EncryptionScopesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list( @@ -88,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +169,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +301,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +360,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_location_based_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_location_based_model_capacities_operations.py index ed37d79e5290..f0cb35cee81f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_location_based_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_location_based_model_capacities_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._location_based_model_capacities_operations import build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +48,12 @@ class LocationBasedModelCapacitiesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list( @@ -81,7 +81,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelCapacityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_model_capacities_operations.py index 287d3c7da2f9..31f666e6b42f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_model_capacities_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._model_capacities_operations import build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +48,12 @@ class ModelCapacitiesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list( @@ -79,7 +79,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelCapacityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_models_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_models_operations.py index ed4de7ac009c..3fe2e9e2a223 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_models_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_models_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._models_operations import build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +48,12 @@ class ModelsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Model"]: @@ -71,7 +71,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.Model"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_network_security_perimeter_configurations_operations.py index e4c5721f6481..cff8dca0bed4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_network_security_perimeter_configurations_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_network_security_perimeter_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, Type, TypeVar, Union, cast +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,16 +32,14 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._network_security_perimeter_configurations_operations import ( build_get_request, build_list_request, build_reconcile_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,10 +58,12 @@ class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name- def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list( @@ -87,7 +88,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +168,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -214,7 +215,7 @@ async def get( async def _reconcile_initial( self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 ff191e3e8446..bf0ff5031f0d 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +48,12 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -69,7 +69,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_endpoint_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_endpoint_connections_operations.py index f6b5a668220f..ad3a8fc54135 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -29,17 +29,15 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._private_endpoint_connections_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,10 +56,12 @@ class PrivateEndpointConnectionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 async def list( @@ -78,7 +78,7 @@ async def list( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -139,7 +139,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -191,7 +191,7 @@ async def _create_or_update_initial( properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -400,7 +400,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_link_resources_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_link_resources_operations.py index 29ee4f4d5b3d..185f9a7cb014 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_link_resources_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,12 +24,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._private_link_resources_operations import build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -48,10 +46,12 @@ class PrivateLinkResourcesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 async def list( @@ -68,7 +68,7 @@ async def list( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_capability_hosts_operations.py new file mode 100644 index 000000000000..727b633c1026 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_capability_hosts_operations.py @@ -0,0 +1,495 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._project_capability_hosts_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, +) +from .._configuration import CognitiveServicesManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProjectCapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`project_capability_hosts` attribute. + """ + + models = _models + + 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") + + async def _delete_initial( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 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 AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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, + capability_host_name=capability_host_name, + api_version=api_version, + 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 + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **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_async + async def get( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """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 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: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + capability_host: Union[_models.CapabilityHost, 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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" + _json = None + _content = None + if isinstance(capability_host, (IOBase, bytes)): + _content = capability_host + else: + _json = self._serialize.body(capability_host, "CapabilityHost") + + _request = build_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, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, + capability_host_name: str, + capability_host: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """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 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.CapabilityHost + :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 either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + capability_host: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """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 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: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + capability_host: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CapabilityHost]: + """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 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 either a CapabilityHost type or a + IO[bytes] type. Required. + :type capability_host: ~azure.mgmt.cognitiveservices.models.CapabilityHost or IO[bytes] + :return: An instance of AsyncLROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapabilityHost] = 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, + capability_host_name=capability_host_name, + capability_host=capability_host, + api_version=api_version, + 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): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_connections_operations.py new file mode 100644 index 000000000000..dbb9694251bd --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_project_connections_operations.py @@ -0,0 +1,624 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._project_connections_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._configuration import CognitiveServicesManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProjectConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`project_connections` attribute. + """ + + models = _models + + 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 + async def delete( + 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 or the result of cls(response) + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace_async + async 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 or the result of cls(response) + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async 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. + + :param resource_group_name: The name of the resource group. The 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async 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. + + 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: 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionUpdateContent, IO[bytes]]] = None, + **kwargs: Any + ) -> _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 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 either a + ConnectionUpdateContent type or a IO[bytes] type. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = 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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _json = self._serialize.body(connection, "ConnectionUpdateContent") + else: + _json = None + + _request = build_update_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=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionPropertiesV2BasicResource, 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 either a + ConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = 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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _json = self._serialize.body(connection, "ConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_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=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + 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 + ) -> AsyncIterable["_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. + + :param resource_group_name: The name of the resource group. The 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 target: Target of the connection. Default value is None. + :type target: str + :param category: Category of the connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either ConnectionPropertiesV2BasicResource or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResourceArmPaginatedResult] = 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_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_projects_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_projects_operations.py new file mode 100644 index 000000000000..4750e287f4ea --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_projects_operations.py @@ -0,0 +1,734 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer +from ...operations._projects_operations import ( + build_create_request, + build_delete_request, + build_get_request, + build_list_request, + build_update_request, +) +from .._configuration import CognitiveServicesManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProjectsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.aio.CognitiveServicesManagementClient`'s + :attr:`projects` attribute. + """ + + models = _models + + 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") + + async def _create_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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" + _json = None + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _json = self._serialize.body(project, "Project") + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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, 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: _models.Project, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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. 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: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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. 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 AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_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 either a Project type or + a IO[bytes] type. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Project] = 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_initial( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + project=project, + api_version=api_version, + 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): + deserialized = self._deserialize("Project", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Project].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Project]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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" + _json = None + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _json = self._serialize.body(project, "Project") + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: _models.Project, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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 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: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_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 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 AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_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 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 either a Project type or + a IO[bytes] type. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or IO[bytes] + :return: An instance of AsyncLROPoller that returns either Project or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Project] = 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, + project=project, + api_version=api_version, + 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): + deserialized = self._deserialize("Project", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Project].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Project]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, account_name: str, project_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """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 project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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, + api_version=api_version, + 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 + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **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_async + async 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 project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: Project or the result of cls(response) + :rtype: ~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 = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Project", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterable["_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 either Project or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProjectListResult] = 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_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProjectListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py index b8594b008c62..cc619ce9fc25 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklist_items_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,25 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import ( - Any, - AsyncIterable, - AsyncIterator, - Callable, - Dict, - IO, - List, - Optional, - Type, - TypeVar, - Union, - cast, - overload, -) +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -46,6 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._rai_blocklist_items_operations import ( build_batch_add_request, build_batch_delete_request, @@ -54,12 +41,9 @@ build_get_request, build_list_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,10 +62,12 @@ class RaiBlocklistItemsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list( @@ -108,7 +94,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiBlockListItemsResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +184,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -343,7 +329,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -408,7 +394,7 @@ async def _delete_initial( rai_blocklist_item_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -622,7 +608,7 @@ async def batch_add( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -679,7 +665,7 @@ async def batch_add( return deserialized # type: ignore @distributed_trace_async - async def batch_delete( # pylint: disable=inconsistent-return-statements + async def batch_delete( self, resource_group_name: str, account_name: str, @@ -703,7 +689,7 @@ async def batch_delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py index 7382d6fd797f..1aea7e44664f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_blocklists_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,17 +32,15 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._rai_blocklists_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,10 +59,12 @@ class RaiBlocklistsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterable["_models.RaiBlocklist"]: @@ -86,7 +86,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiBlockListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +167,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +299,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -358,7 +358,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py index a35659689d30..0e1ea9a4f2af 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_content_filters_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,12 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._rai_content_filters_operations import build_get_request, build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -51,10 +49,12 @@ class RaiContentFiltersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.RaiContentFilter"]: @@ -73,7 +73,7 @@ def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.RaiConten api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiContentFilterListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +147,7 @@ async def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.R :rtype: ~azure.mgmt.cognitiveservices.models.RaiContentFilter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py index bf33aae3b66b..6cfac9978be0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_rai_policies_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,17 +32,15 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._rai_policies_operations import ( build_create_or_update_request, build_delete_request, build_get_request, build_list_request, ) +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -61,10 +59,12 @@ class RaiPoliciesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> AsyncIterable["_models.RaiPolicy"]: @@ -85,7 +85,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiPolicyListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -166,7 +166,7 @@ async def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -298,7 +298,7 @@ async def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -357,7 +357,7 @@ async def create_or_update( async def _delete_initial( self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_resource_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_resource_skus_operations.py index 7e1f28a2e878..cb8b7eb87cef 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_resource_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_resource_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._resource_skus_operations import build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +48,12 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: @@ -70,7 +70,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ResourceSku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_usages_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_usages_operations.py index 7e512e322353..b8ee1dd0e5fe 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_usages_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/aio/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +26,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ..._utils.serialization import Deserializer, Serializer from ...operations._usages_operations import build_list_request +from .._configuration import CognitiveServicesManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +48,12 @@ class UsagesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 def list(self, location: str, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Usage"]: @@ -75,7 +75,7 @@ def list(self, location: str, filter: Optional[str] = None, **kwargs: Any) -> As api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 db9ddda03068..3cc5d025f539 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 @@ -5,181 +5,237 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AbusePenalty -from ._models_py3 import Account -from ._models_py3 import AccountListResult -from ._models_py3 import AccountModel -from ._models_py3 import AccountModelListResult -from ._models_py3 import AccountProperties -from ._models_py3 import AccountSku -from ._models_py3 import AccountSkuListResult -from ._models_py3 import ApiKeys -from ._models_py3 import ApiProperties -from ._models_py3 import AzureEntityResource -from ._models_py3 import BillingMeterInfo -from ._models_py3 import CalculateModelCapacityParameter -from ._models_py3 import CalculateModelCapacityResult -from ._models_py3 import CalculateModelCapacityResultEstimatedCapacity -from ._models_py3 import CallRateLimit -from ._models_py3 import CapacityConfig -from ._models_py3 import CheckDomainAvailabilityParameter -from ._models_py3 import CheckSkuAvailabilityParameter -from ._models_py3 import CommitmentCost -from ._models_py3 import CommitmentPeriod -from ._models_py3 import CommitmentPlan -from ._models_py3 import CommitmentPlanAccountAssociation -from ._models_py3 import CommitmentPlanAccountAssociationListResult -from ._models_py3 import CommitmentPlanAssociation -from ._models_py3 import CommitmentPlanListResult -from ._models_py3 import CommitmentPlanProperties -from ._models_py3 import CommitmentQuota -from ._models_py3 import CommitmentTier -from ._models_py3 import CommitmentTierListResult -from ._models_py3 import CustomBlocklistConfig -from ._models_py3 import DefenderForAISetting -from ._models_py3 import DefenderForAISettingResult -from ._models_py3 import Deployment -from ._models_py3 import DeploymentCapacitySettings -from ._models_py3 import DeploymentListResult -from ._models_py3 import DeploymentModel -from ._models_py3 import DeploymentProperties -from ._models_py3 import DeploymentScaleSettings -from ._models_py3 import DeploymentSkuListResult -from ._models_py3 import DomainAvailability -from ._models_py3 import Encryption -from ._models_py3 import EncryptionScope -from ._models_py3 import EncryptionScopeListResult -from ._models_py3 import EncryptionScopeProperties -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Identity -from ._models_py3 import IpRule -from ._models_py3 import KeyVaultProperties -from ._models_py3 import MetricName -from ._models_py3 import Model -from ._models_py3 import ModelCapacityCalculatorWorkload -from ._models_py3 import ModelCapacityCalculatorWorkloadRequestParam -from ._models_py3 import ModelCapacityListResult -from ._models_py3 import ModelCapacityListResultValueItem -from ._models_py3 import ModelDeprecationInfo -from ._models_py3 import ModelListResult -from ._models_py3 import ModelSku -from ._models_py3 import ModelSkuCapacityProperties -from ._models_py3 import MultiRegionSettings -from ._models_py3 import NetworkRuleSet -from ._models_py3 import NetworkSecurityPerimeter -from ._models_py3 import NetworkSecurityPerimeterAccessRule -from ._models_py3 import NetworkSecurityPerimeterAccessRuleProperties -from ._models_py3 import NetworkSecurityPerimeterAccessRulePropertiesSubscriptionsItem -from ._models_py3 import NetworkSecurityPerimeterConfiguration -from ._models_py3 import NetworkSecurityPerimeterConfigurationAssociationInfo -from ._models_py3 import NetworkSecurityPerimeterConfigurationList -from ._models_py3 import NetworkSecurityPerimeterConfigurationProperties -from ._models_py3 import NetworkSecurityPerimeterProfileInfo -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import PatchResourceTags -from ._models_py3 import PatchResourceTagsAndSku -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateEndpointConnectionProperties -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkResourceProperties -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProvisioningIssue -from ._models_py3 import ProvisioningIssueProperties -from ._models_py3 import ProxyResource -from ._models_py3 import QuotaLimit -from ._models_py3 import RaiBlockListItemsResult -from ._models_py3 import RaiBlockListResult -from ._models_py3 import RaiBlocklist -from ._models_py3 import RaiBlocklistConfig -from ._models_py3 import RaiBlocklistItem -from ._models_py3 import RaiBlocklistItemBulkRequest -from ._models_py3 import RaiBlocklistItemProperties -from ._models_py3 import RaiBlocklistProperties -from ._models_py3 import RaiContentFilter -from ._models_py3 import RaiContentFilterListResult -from ._models_py3 import RaiContentFilterProperties -from ._models_py3 import RaiMonitorConfig -from ._models_py3 import RaiPolicy -from ._models_py3 import RaiPolicyContentFilter -from ._models_py3 import RaiPolicyListResult -from ._models_py3 import RaiPolicyProperties -from ._models_py3 import RegenerateKeyParameters -from ._models_py3 import RegionSetting -from ._models_py3 import RequestMatchPattern -from ._models_py3 import Resource -from ._models_py3 import ResourceSku -from ._models_py3 import ResourceSkuListResult -from ._models_py3 import ResourceSkuRestrictionInfo -from ._models_py3 import ResourceSkuRestrictions -from ._models_py3 import Sku -from ._models_py3 import SkuAvailability -from ._models_py3 import SkuAvailabilityListResult -from ._models_py3 import SkuCapability -from ._models_py3 import SkuChangeInfo -from ._models_py3 import SkuResource -from ._models_py3 import SystemData -from ._models_py3 import ThrottlingRule -from ._models_py3 import Usage -from ._models_py3 import UsageListResult -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import UserOwnedAmlWorkspace -from ._models_py3 import UserOwnedStorage -from ._models_py3 import VirtualNetworkRule +from typing import TYPE_CHECKING -from ._cognitive_services_management_client_enums import AbusePenaltyAction -from ._cognitive_services_management_client_enums import ActionType -from ._cognitive_services_management_client_enums import ByPassSelection -from ._cognitive_services_management_client_enums import CommitmentPlanProvisioningState -from ._cognitive_services_management_client_enums import ContentLevel -from ._cognitive_services_management_client_enums import CreatedByType -from ._cognitive_services_management_client_enums import DefenderForAISettingState -from ._cognitive_services_management_client_enums import DeploymentModelVersionUpgradeOption -from ._cognitive_services_management_client_enums import DeploymentProvisioningState -from ._cognitive_services_management_client_enums import DeploymentScaleType -from ._cognitive_services_management_client_enums import EncryptionScopeProvisioningState -from ._cognitive_services_management_client_enums import EncryptionScopeState -from ._cognitive_services_management_client_enums import HostingModel -from ._cognitive_services_management_client_enums import KeyName -from ._cognitive_services_management_client_enums import KeySource -from ._cognitive_services_management_client_enums import ModelLifecycleStatus -from ._cognitive_services_management_client_enums import NetworkRuleAction -from ._cognitive_services_management_client_enums import NspAccessRuleDirection -from ._cognitive_services_management_client_enums import Origin -from ._cognitive_services_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._cognitive_services_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._cognitive_services_management_client_enums import ProvisioningState -from ._cognitive_services_management_client_enums import PublicNetworkAccess -from ._cognitive_services_management_client_enums import QuotaUsageStatus -from ._cognitive_services_management_client_enums import RaiPolicyContentSource -from ._cognitive_services_management_client_enums import RaiPolicyMode -from ._cognitive_services_management_client_enums import RaiPolicyType -from ._cognitive_services_management_client_enums import ResourceIdentityType -from ._cognitive_services_management_client_enums import ResourceSkuRestrictionsReasonCode -from ._cognitive_services_management_client_enums import ResourceSkuRestrictionsType -from ._cognitive_services_management_client_enums import RoutingMethods -from ._cognitive_services_management_client_enums import SkuTier -from ._cognitive_services_management_client_enums import UnitType +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AADAuthTypeConnectionProperties, + AbusePenalty, + AccessKeyAuthTypeConnectionProperties, + Account, + AccountKeyAuthTypeConnectionProperties, + AccountListResult, + AccountModel, + AccountModelListResult, + AccountProperties, + AccountSku, + AccountSkuListResult, + ApiKeyAuthConnectionProperties, + ApiKeys, + ApiProperties, + AzureEntityResource, + BillingMeterInfo, + CalculateModelCapacityParameter, + CalculateModelCapacityResult, + CalculateModelCapacityResultEstimatedCapacity, + CallRateLimit, + CapabilityHost, + CapabilityHostProperties, + CapacityConfig, + CheckDomainAvailabilityParameter, + CheckSkuAvailabilityParameter, + CommitmentCost, + CommitmentPeriod, + CommitmentPlan, + CommitmentPlanAccountAssociation, + CommitmentPlanAccountAssociationListResult, + CommitmentPlanAssociation, + CommitmentPlanListResult, + CommitmentPlanProperties, + CommitmentQuota, + CommitmentTier, + CommitmentTierListResult, + ConnectionAccessKey, + ConnectionAccountKey, + ConnectionApiKey, + ConnectionManagedIdentity, + ConnectionOAuth2, + ConnectionPersonalAccessToken, + ConnectionPropertiesV2, + ConnectionPropertiesV2BasicResource, + ConnectionPropertiesV2BasicResourceArmPaginatedResult, + ConnectionServicePrincipal, + ConnectionSharedAccessSignature, + ConnectionUpdateContent, + ConnectionUsernamePassword, + CustomBlocklistConfig, + CustomKeys, + CustomKeysConnectionProperties, + DefenderForAISetting, + DefenderForAISettingResult, + Deployment, + DeploymentCapacitySettings, + DeploymentListResult, + DeploymentModel, + DeploymentProperties, + DeploymentScaleSettings, + DeploymentSkuListResult, + DomainAvailability, + Encryption, + EncryptionScope, + EncryptionScopeListResult, + EncryptionScopeProperties, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + Identity, + IpRule, + KeyVaultProperties, + ManagedIdentityAuthTypeConnectionProperties, + MetricName, + Model, + ModelCapacityCalculatorWorkload, + ModelCapacityCalculatorWorkloadRequestParam, + ModelCapacityListResult, + ModelCapacityListResultValueItem, + ModelDeprecationInfo, + ModelListResult, + ModelSku, + ModelSkuCapacityProperties, + MultiRegionSettings, + NetworkInjections, + NetworkRuleSet, + NetworkSecurityPerimeter, + NetworkSecurityPerimeterAccessRule, + NetworkSecurityPerimeterAccessRuleProperties, + NetworkSecurityPerimeterAccessRulePropertiesSubscriptionsItem, + NetworkSecurityPerimeterConfiguration, + NetworkSecurityPerimeterConfigurationAssociationInfo, + NetworkSecurityPerimeterConfigurationList, + NetworkSecurityPerimeterConfigurationProperties, + NetworkSecurityPerimeterProfileInfo, + NoneAuthTypeConnectionProperties, + OAuth2AuthTypeConnectionProperties, + Operation, + OperationDisplay, + OperationListResult, + PATAuthTypeConnectionProperties, + PatchResourceTags, + PatchResourceTagsAndSku, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkResourceProperties, + PrivateLinkServiceConnectionState, + Project, + ProjectListResult, + ProjectProperties, + ProvisioningIssue, + ProvisioningIssueProperties, + ProxyResource, + QuotaLimit, + RaiBlockListItemsResult, + RaiBlockListResult, + RaiBlocklist, + RaiBlocklistConfig, + RaiBlocklistItem, + RaiBlocklistItemBulkRequest, + RaiBlocklistItemProperties, + RaiBlocklistProperties, + RaiContentFilter, + RaiContentFilterListResult, + RaiContentFilterProperties, + RaiMonitorConfig, + RaiPolicy, + RaiPolicyContentFilter, + RaiPolicyListResult, + RaiPolicyProperties, + RegenerateKeyParameters, + RegionSetting, + RequestMatchPattern, + Resource, + ResourceBase, + ResourceSku, + ResourceSkuListResult, + ResourceSkuRestrictionInfo, + ResourceSkuRestrictions, + SASAuthTypeConnectionProperties, + ServicePrincipalAuthTypeConnectionProperties, + Sku, + SkuAvailability, + SkuAvailabilityListResult, + SkuCapability, + SkuChangeInfo, + SkuResource, + SystemData, + ThrottlingRule, + Usage, + UsageListResult, + UserAssignedIdentity, + UserOwnedAmlWorkspace, + UserOwnedStorage, + UsernamePasswordAuthTypeConnectionProperties, + VirtualNetworkRule, +) + +from ._cognitive_services_management_client_enums import ( # type: ignore + AbusePenaltyAction, + ActionType, + ByPassSelection, + CapabilityHostKind, + CapabilityHostProvisioningState, + CommitmentPlanProvisioningState, + ConnectionAuthType, + ConnectionCategory, + ConnectionGroup, + ContentLevel, + CreatedByType, + DefenderForAISettingState, + DeploymentModelVersionUpgradeOption, + DeploymentProvisioningState, + DeploymentScaleType, + EncryptionScopeProvisioningState, + EncryptionScopeState, + HostingModel, + KeyName, + KeySource, + ManagedPERequirement, + ManagedPEStatus, + ModelLifecycleStatus, + NetworkRuleAction, + NspAccessRuleDirection, + Origin, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + QuotaUsageStatus, + RaiPolicyContentSource, + RaiPolicyMode, + RaiPolicyType, + ResourceIdentityType, + ResourceSkuRestrictionsReasonCode, + ResourceSkuRestrictionsType, + RoutingMethods, + ScenarioType, + SkuTier, + UnitType, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "AADAuthTypeConnectionProperties", "AbusePenalty", + "AccessKeyAuthTypeConnectionProperties", "Account", + "AccountKeyAuthTypeConnectionProperties", "AccountListResult", "AccountModel", "AccountModelListResult", "AccountProperties", "AccountSku", "AccountSkuListResult", + "ApiKeyAuthConnectionProperties", "ApiKeys", "ApiProperties", "AzureEntityResource", @@ -188,6 +244,8 @@ "CalculateModelCapacityResult", "CalculateModelCapacityResultEstimatedCapacity", "CallRateLimit", + "CapabilityHost", + "CapabilityHostProperties", "CapacityConfig", "CheckDomainAvailabilityParameter", "CheckSkuAvailabilityParameter", @@ -202,7 +260,22 @@ "CommitmentQuota", "CommitmentTier", "CommitmentTierListResult", + "ConnectionAccessKey", + "ConnectionAccountKey", + "ConnectionApiKey", + "ConnectionManagedIdentity", + "ConnectionOAuth2", + "ConnectionPersonalAccessToken", + "ConnectionPropertiesV2", + "ConnectionPropertiesV2BasicResource", + "ConnectionPropertiesV2BasicResourceArmPaginatedResult", + "ConnectionServicePrincipal", + "ConnectionSharedAccessSignature", + "ConnectionUpdateContent", + "ConnectionUsernamePassword", "CustomBlocklistConfig", + "CustomKeys", + "CustomKeysConnectionProperties", "DefenderForAISetting", "DefenderForAISettingResult", "Deployment", @@ -223,6 +296,7 @@ "Identity", "IpRule", "KeyVaultProperties", + "ManagedIdentityAuthTypeConnectionProperties", "MetricName", "Model", "ModelCapacityCalculatorWorkload", @@ -234,6 +308,7 @@ "ModelSku", "ModelSkuCapacityProperties", "MultiRegionSettings", + "NetworkInjections", "NetworkRuleSet", "NetworkSecurityPerimeter", "NetworkSecurityPerimeterAccessRule", @@ -244,9 +319,12 @@ "NetworkSecurityPerimeterConfigurationList", "NetworkSecurityPerimeterConfigurationProperties", "NetworkSecurityPerimeterProfileInfo", + "NoneAuthTypeConnectionProperties", + "OAuth2AuthTypeConnectionProperties", "Operation", "OperationDisplay", "OperationListResult", + "PATAuthTypeConnectionProperties", "PatchResourceTags", "PatchResourceTagsAndSku", "PrivateEndpoint", @@ -257,6 +335,9 @@ "PrivateLinkResourceListResult", "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", + "Project", + "ProjectListResult", + "ProjectProperties", "ProvisioningIssue", "ProvisioningIssueProperties", "ProxyResource", @@ -281,10 +362,13 @@ "RegionSetting", "RequestMatchPattern", "Resource", + "ResourceBase", "ResourceSku", "ResourceSkuListResult", "ResourceSkuRestrictionInfo", "ResourceSkuRestrictions", + "SASAuthTypeConnectionProperties", + "ServicePrincipalAuthTypeConnectionProperties", "Sku", "SkuAvailability", "SkuAvailabilityListResult", @@ -298,11 +382,17 @@ "UserAssignedIdentity", "UserOwnedAmlWorkspace", "UserOwnedStorage", + "UsernamePasswordAuthTypeConnectionProperties", "VirtualNetworkRule", "AbusePenaltyAction", "ActionType", "ByPassSelection", + "CapabilityHostKind", + "CapabilityHostProvisioningState", "CommitmentPlanProvisioningState", + "ConnectionAuthType", + "ConnectionCategory", + "ConnectionGroup", "ContentLevel", "CreatedByType", "DefenderForAISettingState", @@ -314,6 +404,8 @@ "HostingModel", "KeyName", "KeySource", + "ManagedPERequirement", + "ManagedPEStatus", "ModelLifecycleStatus", "NetworkRuleAction", "NspAccessRuleDirection", @@ -330,8 +422,9 @@ "ResourceSkuRestrictionsReasonCode", "ResourceSkuRestrictionsType", "RoutingMethods", + "ScenarioType", "SkuTier", "UnitType", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__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/_cognitive_services_management_client_enums.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py index dd6c2d3b7c4d..927606a5d5f5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_cognitive_services_management_client_enums.py @@ -30,6 +30,23 @@ class ByPassSelection(str, Enum, metaclass=CaseInsensitiveEnumMeta): AZURE_SERVICES = "AzureServices" +class CapabilityHostKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CapabilityHostKind.""" + + AGENTS = "Agents" + + +class CapabilityHostProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of capability host.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + + class CommitmentPlanProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets the status of the resource at the time the operation was called.""" @@ -42,6 +59,145 @@ class CommitmentPlanProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMe CANCELED = "Canceled" +class ConnectionAuthType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Authentication type of the connection target.""" + + PAT = "PAT" + MANAGED_IDENTITY = "ManagedIdentity" + USERNAME_PASSWORD = "UsernamePassword" + NONE = "None" + SAS = "SAS" + ACCOUNT_KEY = "AccountKey" + SERVICE_PRINCIPAL = "ServicePrincipal" + ACCESS_KEY = "AccessKey" + API_KEY = "ApiKey" + CUSTOM_KEYS = "CustomKeys" + O_AUTH2 = "OAuth2" + AAD = "AAD" + + +class ConnectionCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Category of the connection.""" + + PYTHON_FEED = "PythonFeed" + CONTAINER_REGISTRY = "ContainerRegistry" + GIT = "Git" + S3 = "S3" + SNOWFLAKE = "Snowflake" + AZURE_SQL_DB = "AzureSqlDb" + AZURE_SYNAPSE_ANALYTICS = "AzureSynapseAnalytics" + AZURE_MY_SQL_DB = "AzureMySqlDb" + AZURE_POSTGRES_DB = "AzurePostgresDb" + ADLS_GEN2 = "ADLSGen2" + REDIS = "Redis" + API_KEY = "ApiKey" + AZURE_OPEN_AI = "AzureOpenAI" + AI_SERVICES = "AIServices" + COGNITIVE_SEARCH = "CognitiveSearch" + COGNITIVE_SERVICE = "CognitiveService" + CUSTOM_KEYS = "CustomKeys" + AZURE_BLOB = "AzureBlob" + AZURE_ONE_LAKE = "AzureOneLake" + COSMOS_DB = "CosmosDb" + COSMOS_DB_MONGO_DB_API = "CosmosDbMongoDbApi" + AZURE_DATA_EXPLORER = "AzureDataExplorer" + AZURE_MARIA_DB = "AzureMariaDb" + AZURE_DATABRICKS_DELTA_LAKE = "AzureDatabricksDeltaLake" + AZURE_SQL_MI = "AzureSqlMi" + AZURE_TABLE_STORAGE = "AzureTableStorage" + AMAZON_RDS_FOR_ORACLE = "AmazonRdsForOracle" + AMAZON_RDS_FOR_SQL_SERVER = "AmazonRdsForSqlServer" + AMAZON_REDSHIFT = "AmazonRedshift" + DB2 = "Db2" + DRILL = "Drill" + GOOGLE_BIG_QUERY = "GoogleBigQuery" + GREENPLUM = "Greenplum" + HBASE = "Hbase" + HIVE = "Hive" + IMPALA = "Impala" + INFORMIX = "Informix" + MARIA_DB = "MariaDb" + MICROSOFT_ACCESS = "MicrosoftAccess" + MY_SQL = "MySql" + NETEZZA = "Netezza" + ORACLE = "Oracle" + PHOENIX = "Phoenix" + POSTGRE_SQL = "PostgreSql" + PRESTO = "Presto" + SAP_OPEN_HUB = "SapOpenHub" + SAP_BW = "SapBw" + SAP_HANA = "SapHana" + SAP_TABLE = "SapTable" + SPARK = "Spark" + SQL_SERVER = "SqlServer" + SYBASE = "Sybase" + TERADATA = "Teradata" + VERTICA = "Vertica" + PINECONE = "Pinecone" + CASSANDRA = "Cassandra" + COUCHBASE = "Couchbase" + MONGO_DB_V2 = "MongoDbV2" + MONGO_DB_ATLAS = "MongoDbAtlas" + AMAZON_S3_COMPATIBLE = "AmazonS3Compatible" + FILE_SERVER = "FileServer" + FTP_SERVER = "FtpServer" + GOOGLE_CLOUD_STORAGE = "GoogleCloudStorage" + HDFS = "Hdfs" + ORACLE_CLOUD_STORAGE = "OracleCloudStorage" + SFTP = "Sftp" + GENERIC_HTTP = "GenericHttp" + O_DATA_REST = "ODataRest" + ODBC = "Odbc" + GENERIC_REST = "GenericRest" + AMAZON_MWS = "AmazonMws" + CONCUR = "Concur" + DYNAMICS = "Dynamics" + DYNAMICS_AX = "DynamicsAx" + DYNAMICS_CRM = "DynamicsCrm" + GOOGLE_AD_WORDS = "GoogleAdWords" + HUBSPOT = "Hubspot" + JIRA = "Jira" + MAGENTO = "Magento" + MARKETO = "Marketo" + OFFICE365 = "Office365" + ELOQUA = "Eloqua" + RESPONSYS = "Responsys" + ORACLE_SERVICE_CLOUD = "OracleServiceCloud" + PAY_PAL = "PayPal" + QUICK_BOOKS = "QuickBooks" + SALESFORCE = "Salesforce" + SALESFORCE_SERVICE_CLOUD = "SalesforceServiceCloud" + SALESFORCE_MARKETING_CLOUD = "SalesforceMarketingCloud" + SAP_CLOUD_FOR_CUSTOMER = "SapCloudForCustomer" + SAP_ECC = "SapEcc" + SERVICE_NOW = "ServiceNow" + SHARE_POINT_ONLINE_LIST = "SharePointOnlineList" + SHOPIFY = "Shopify" + SQUARE = "Square" + WEB_TABLE = "WebTable" + XERO = "Xero" + ZOHO = "Zoho" + GENERIC_CONTAINER_REGISTRY = "GenericContainerRegistry" + ELASTICSEARCH = "Elasticsearch" + OPEN_AI = "OpenAI" + SERP = "Serp" + BING_LLM_SEARCH = "BingLLMSearch" + SERVERLESS = "Serverless" + MANAGED_ONLINE_ENDPOINT = "ManagedOnlineEndpoint" + + +class ConnectionGroup(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Group based on connection category.""" + + AZURE = "Azure" + AZURE_AI = "AzureAI" + DATABASE = "Database" + NO_SQL = "NoSQL" + FILE = "File" + GENERIC_PROTOCOL = "GenericProtocol" + SERVICES_AND_APPS = "ServicesAndApps" + + class ContentLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Level at which content is filtered.""" @@ -136,6 +292,22 @@ class KeySource(str, Enum, metaclass=CaseInsensitiveEnumMeta): MICROSOFT_KEY_VAULT = "Microsoft.KeyVault" +class ManagedPERequirement(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ManagedPERequirement.""" + + REQUIRED = "Required" + NOT_REQUIRED = "NotRequired" + NOT_APPLICABLE = "NotApplicable" + + +class ManagedPEStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ManagedPEStatus.""" + + INACTIVE = "Inactive" + ACTIVE = "Active" + NOT_APPLICABLE = "NotApplicable" + + class ModelLifecycleStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Model lifecycle status.""" @@ -199,6 +371,7 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "Failed" SUCCEEDED = "Succeeded" RESOLVING_DNS = "ResolvingDNS" + CANCELED = "Canceled" class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -226,7 +399,7 @@ class RaiPolicyContentSource(str, Enum, metaclass=CaseInsensitiveEnumMeta): class RaiPolicyMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, Blocking=2, - Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is the same as + Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-06-01. It is the same as 'Deferred' in previous version. """ @@ -274,6 +447,15 @@ class RoutingMethods(str, Enum, metaclass=CaseInsensitiveEnumMeta): PERFORMANCE = "Performance" +class ScenarioType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies what features in AI Foundry network injection applies to. Currently only supports + 'agent' for agent scenarios. 'none' means no network injection. + """ + + NONE = "none" + AGENT = "agent" + + class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py index 832cd00a6a3f..86f6a58c80dc 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/models/_models_py3.py @@ -1,5 +1,5 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,21 +7,346 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from .. import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +from .._utils import serialization as _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] + + +class ConnectionPropertiesV2(_serialization.Model): + """Connection property base schema. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AADAuthTypeConnectionProperties, AccessKeyAuthTypeConnectionProperties, + AccountKeyAuthTypeConnectionProperties, ApiKeyAuthConnectionProperties, + CustomKeysConnectionProperties, ManagedIdentityAuthTypeConnectionProperties, + NoneAuthTypeConnectionProperties, OAuth2AuthTypeConnectionProperties, + PATAuthTypeConnectionProperties, SASAuthTypeConnectionProperties, + ServicePrincipalAuthTypeConnectionProperties, UsernamePasswordAuthTypeConnectionProperties + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + _subtype_map = { + "auth_type": { + "AAD": "AADAuthTypeConnectionProperties", + "AccessKey": "AccessKeyAuthTypeConnectionProperties", + "AccountKey": "AccountKeyAuthTypeConnectionProperties", + "ApiKey": "ApiKeyAuthConnectionProperties", + "CustomKeys": "CustomKeysConnectionProperties", + "ManagedIdentity": "ManagedIdentityAuthTypeConnectionProperties", + "None": "NoneAuthTypeConnectionProperties", + "OAuth2": "OAuth2AuthTypeConnectionProperties", + "PAT": "PATAuthTypeConnectionProperties", + "SAS": "SASAuthTypeConnectionProperties", + "ServicePrincipal": "ServicePrincipalAuthTypeConnectionProperties", + "UsernamePassword": "UsernamePasswordAuthTypeConnectionProperties", + } + } + + 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, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + """ + super().__init__(**kwargs) + self.auth_type: Optional[str] = None + self.category = category + self.created_by_workspace_arm_id: Optional[str] = None + self.error = error + self.expiry_time = expiry_time + self.group: Optional[Union[str, "_models.ConnectionGroup"]] = None + self.is_shared_to_all = is_shared_to_all + self.metadata = metadata + self.pe_requirement = pe_requirement + self.pe_status = pe_status + self.shared_user_list = shared_user_list + self.target = target + self.use_workspace_managed_identity = use_workspace_managed_identity + + +class AADAuthTypeConnectionProperties(ConnectionPropertiesV2): + """This connection type covers the AAD auth for any applicable Azure service. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + 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, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AAD" class AbusePenalty(_serialization.Model): @@ -63,13 +388,173 @@ def __init__( self.expiration = expiration +class AccessKeyAuthTypeConnectionProperties(ConnectionPropertiesV2): + """AccessKeyAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionAccessKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionAccessKey"}, + } + + 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.ConnectionAccessKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionAccessKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AccessKey" + self.credentials = credentials + + class Resource(_serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -93,9 +578,9 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class AzureEntityResource(Resource): @@ -104,7 +589,7 @@ class AzureEntityResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -132,17 +617,17 @@ class AzureEntityResource(Resource): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.etag = None + self.etag: Optional[str] = None -class Account(AzureEntityResource): # pylint: disable=too-many-instance-attributes +class Account(AzureEntityResource): """Cognitive Services account is an Azure resource representing the provisioned account, it's type, location and SKU. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -218,12 +703,172 @@ def __init__( self.kind = kind self.sku = sku self.identity = identity - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None self.tags = tags self.location = location self.properties = properties +class AccountKeyAuthTypeConnectionProperties(ConnectionPropertiesV2): + """This connection type covers the account key connection for Azure storage. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Account key object for connection credential. + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionAccountKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionAccountKey"}, + } + + 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.ConnectionAccountKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Account key object for connection credential. + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionAccountKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "AccountKey" + self.credentials = credentials + + class AccountListResult(_serialization.Model): """The list of cognitive services accounts operation response. @@ -251,7 +896,7 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ super().__init__(**kwargs) self.next_link = next_link - self.value = None + self.value: Optional[List["_models.Account"]] = None class DeploymentModel(_serialization.Model): @@ -329,10 +974,10 @@ def __init__( self.version = version self.source = source self.source_account = source_account - self.call_rate_limit = None + self.call_rate_limit: Optional["_models.CallRateLimit"] = None -class AccountModel(DeploymentModel): # pylint: disable=too-many-instance-attributes +class AccountModel(DeploymentModel): """Cognitive Services account Model. Variables are only populated by the server, and will be ignored when sending a request. @@ -471,7 +1116,7 @@ def __init__( self.finetune_capabilities = finetune_capabilities self.deprecation = deprecation self.lifecycle_status = lifecycle_status - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None class AccountModelListResult(_serialization.Model): @@ -502,14 +1147,14 @@ def __init__( self.value = value -class AccountProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class AccountProperties(_serialization.Model): """Properties of Cognitive Services account. Variables are only populated by the server, and will be ignored when sending a request. :ivar provisioning_state: Gets the status of the cognitive services account at the time the operation was called. Known values are: "Accepted", "Creating", "Deleting", "Moving", "Failed", - "Succeeded", and "ResolvingDNS". + "Succeeded", "ResolvingDNS", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState :ivar endpoint: Endpoint of the created account. :vartype endpoint: str @@ -534,7 +1179,7 @@ class AccountProperties(_serialization.Model): # pylint: disable=too-many-insta :vartype encryption: ~azure.mgmt.cognitiveservices.models.Encryption :ivar user_owned_storage: The storage accounts for this resource. :vartype user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] - :ivar aml_workspace: The user owned AML workspace properties. + :ivar aml_workspace: The user owned AML account properties. :vartype aml_workspace: ~azure.mgmt.cognitiveservices.models.UserOwnedAmlWorkspace :ivar private_endpoint_connections: The private endpoint connection associated with the Cognitive Services account. @@ -577,6 +1222,20 @@ class AccountProperties(_serialization.Model): # pylint: disable=too-many-insta :vartype abuse_penalty: ~azure.mgmt.cognitiveservices.models.AbusePenalty :ivar rai_monitor_config: Cognitive Services Rai Monitor Config. :vartype rai_monitor_config: ~azure.mgmt.cognitiveservices.models.RaiMonitorConfig + :ivar network_injections: Specifies in AI Foundry where virtual network injection occurs to + secure scenarios like Agents entirely within the user's private network, eliminating public + internet exposure while maintaining control over network configurations and resources. + :vartype network_injections: ~azure.mgmt.cognitiveservices.models.NetworkInjections + :ivar allow_project_management: Specifies whether this resource support project management as + child resources, used as containers for access management, data isolation and cost in AI + Foundry. + :vartype allow_project_management: bool + :ivar default_project: Specifies the project, by project name, that is targeted when data plane + endpoints are called without a project parameter. + :vartype default_project: str + :ivar associated_projects: Specifies the projects, by project name, that are associated with + this resource. + :vartype associated_projects: list[str] """ _validation = { @@ -628,6 +1287,10 @@ class AccountProperties(_serialization.Model): # pylint: disable=too-many-insta "commitment_plan_associations": {"key": "commitmentPlanAssociations", "type": "[CommitmentPlanAssociation]"}, "abuse_penalty": {"key": "abusePenalty", "type": "AbusePenalty"}, "rai_monitor_config": {"key": "raiMonitorConfig", "type": "RaiMonitorConfig"}, + "network_injections": {"key": "networkInjections", "type": "NetworkInjections"}, + "allow_project_management": {"key": "allowProjectManagement", "type": "bool"}, + "default_project": {"key": "defaultProject", "type": "str"}, + "associated_projects": {"key": "associatedProjects", "type": "[str]"}, } def __init__( # pylint: disable=too-many-locals @@ -648,6 +1311,10 @@ def __init__( # pylint: disable=too-many-locals restore: Optional[bool] = None, locations: Optional["_models.MultiRegionSettings"] = None, rai_monitor_config: Optional["_models.RaiMonitorConfig"] = None, + network_injections: Optional["_models.NetworkInjections"] = None, + allow_project_management: Optional[bool] = None, + default_project: Optional[str] = None, + associated_projects: Optional[List[str]] = None, **kwargs: Any ) -> None: """ @@ -662,7 +1329,7 @@ def __init__( # pylint: disable=too-many-locals :paramtype encryption: ~azure.mgmt.cognitiveservices.models.Encryption :keyword user_owned_storage: The storage accounts for this resource. :paramtype user_owned_storage: list[~azure.mgmt.cognitiveservices.models.UserOwnedStorage] - :keyword aml_workspace: The user owned AML workspace properties. + :keyword aml_workspace: The user owned AML account properties. :paramtype aml_workspace: ~azure.mgmt.cognitiveservices.models.UserOwnedAmlWorkspace :keyword public_network_access: Whether or not public endpoint access is allowed for this account. Known values are: "Enabled" and "Disabled". @@ -684,38 +1351,56 @@ def __init__( # pylint: disable=too-many-locals :paramtype locations: ~azure.mgmt.cognitiveservices.models.MultiRegionSettings :keyword rai_monitor_config: Cognitive Services Rai Monitor Config. :paramtype rai_monitor_config: ~azure.mgmt.cognitiveservices.models.RaiMonitorConfig + :keyword network_injections: Specifies in AI Foundry where virtual network injection occurs to + secure scenarios like Agents entirely within the user's private network, eliminating public + internet exposure while maintaining control over network configurations and resources. + :paramtype network_injections: ~azure.mgmt.cognitiveservices.models.NetworkInjections + :keyword allow_project_management: Specifies whether this resource support project management + as child resources, used as containers for access management, data isolation and cost in AI + Foundry. + :paramtype allow_project_management: bool + :keyword default_project: Specifies the project, by project name, that is targeted when data + plane endpoints are called without a project parameter. + :paramtype default_project: str + :keyword associated_projects: Specifies the projects, by project name, that are associated with + this resource. + :paramtype associated_projects: list[str] """ super().__init__(**kwargs) - self.provisioning_state = None - self.endpoint = None - self.internal_id = None - self.capabilities = None - self.is_migrated = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.endpoint: Optional[str] = None + self.internal_id: Optional[str] = None + self.capabilities: Optional[List["_models.SkuCapability"]] = None + self.is_migrated: Optional[bool] = None self.migration_token = migration_token - self.sku_change_info = None + self.sku_change_info: Optional["_models.SkuChangeInfo"] = None self.custom_sub_domain_name = custom_sub_domain_name self.network_acls = network_acls self.encryption = encryption self.user_owned_storage = user_owned_storage self.aml_workspace = aml_workspace - self.private_endpoint_connections = None + self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None self.public_network_access = public_network_access self.api_properties = api_properties - self.date_created = None - self.call_rate_limit = None + self.date_created: Optional[str] = None + self.call_rate_limit: Optional["_models.CallRateLimit"] = None self.dynamic_throttling_enabled = dynamic_throttling_enabled - self.quota_limit = None + self.quota_limit: Optional["_models.QuotaLimit"] = None self.restrict_outbound_network_access = restrict_outbound_network_access self.allowed_fqdn_list = allowed_fqdn_list self.disable_local_auth = disable_local_auth - self.endpoints = None + self.endpoints: Optional[Dict[str, str]] = None self.restore = restore - self.deletion_date = None - self.scheduled_purge_date = None + self.deletion_date: Optional[str] = None + self.scheduled_purge_date: Optional[str] = None self.locations = locations - self.commitment_plan_associations = None - self.abuse_penalty = None + self.commitment_plan_associations: Optional[List["_models.CommitmentPlanAssociation"]] = None + self.abuse_penalty: Optional["_models.AbusePenalty"] = None self.rai_monitor_config = rai_monitor_config + self.network_injections = network_injections + self.allow_project_management = allow_project_management + self.default_project = default_project + self.associated_projects = associated_projects class AccountSku(_serialization.Model): @@ -766,6 +1451,185 @@ def __init__(self, *, value: Optional[List["_models.AccountSku"]] = None, **kwar self.value = value +class ApiKeyAuthConnectionProperties(ConnectionPropertiesV2): + """This connection type covers the generic ApiKey auth connection categories, for examples: + AzureOpenAI: + Category:= AzureOpenAI + AuthType:= ApiKey (as type discriminator) + Credentials:= {ApiKey} as .ApiKey + Target:= {ApiBase} + + CognitiveService: + Category:= CognitiveService + AuthType:= ApiKey (as type discriminator) + Credentials:= {SubscriptionKey} as ApiKey + Target:= ServiceRegion={serviceRegion} + + CognitiveSearch: + Category:= CognitiveSearch + AuthType:= ApiKey (as type discriminator) + Credentials:= {Key} as ApiKey + Target:= {Endpoint} + + Use Metadata property bag for ApiType, ApiVersion, Kind and other metadata fields. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Api key object for connection credential. + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionApiKey + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionApiKey"}, + } + + 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.ConnectionApiKey"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Api key object for connection credential. + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionApiKey + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ApiKey" + self.credentials = credentials + + class ApiKeys(_serialization.Model): """The access keys for the cognitive services account. @@ -792,7 +1656,7 @@ def __init__(self, *, key1: Optional[str] = None, key2: Optional[str] = None, ** self.key2 = key2 -class ApiProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class ApiProperties(_serialization.Model): """The api properties for special APIs. :ivar additional_properties: Unmatched properties from the message are deserialized to this @@ -1090,6 +1954,183 @@ def __init__( self.rules = rules +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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 + """ + + +class CapabilityHost(ProxyResource): + """Azure Resource Manager resource envelope. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :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 properties: [Required] Additional attributes of the entity. Required. + :vartype properties: ~azure.mgmt.cognitiveservices.models.CapabilityHostProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "CapabilityHostProperties"}, + } + + def __init__(self, *, properties: "_models.CapabilityHostProperties", **kwargs: Any) -> None: + """ + :keyword properties: [Required] Additional attributes of the entity. Required. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.CapabilityHostProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class ResourceBase(_serialization.Model): + """ResourceBase. + + :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] + """ + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, *, description: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any + ) -> None: + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.description = description + self.tags = tags + + +class CapabilityHostProperties(ResourceBase): + """CapabilityHostProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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 ai_services_connections: List of AI services connections. + :vartype ai_services_connections: list[str] + :ivar capability_host_kind: Kind of this capability host. "Agents" + :vartype capability_host_kind: str or ~azure.mgmt.cognitiveservices.models.CapabilityHostKind + :ivar customer_subnet: Customer subnet info to help set up this capability host. + :vartype customer_subnet: str + :ivar provisioning_state: Provisioning state for the CapabilityHost. Known values are: + "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". + :vartype provisioning_state: str or + ~azure.mgmt.cognitiveservices.models.CapabilityHostProvisioningState + :ivar storage_connections: List of connection names from those available in the account or + project to be used as a storage resource. + :vartype storage_connections: list[str] + :ivar thread_storage_connections: List of connection names from those available in the account + or project to be used for Thread storage. + :vartype thread_storage_connections: list[str] + :ivar vector_store_connections: List of connection names from those available in the account or + project to be used for vector database (e.g. CosmosDB). + :vartype vector_store_connections: list[str] + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "description": {"key": "description", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "ai_services_connections": {"key": "aiServicesConnections", "type": "[str]"}, + "capability_host_kind": {"key": "capabilityHostKind", "type": "str"}, + "customer_subnet": {"key": "customerSubnet", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "storage_connections": {"key": "storageConnections", "type": "[str]"}, + "thread_storage_connections": {"key": "threadStorageConnections", "type": "[str]"}, + "vector_store_connections": {"key": "vectorStoreConnections", "type": "[str]"}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + ai_services_connections: Optional[List[str]] = None, + capability_host_kind: Optional[Union[str, "_models.CapabilityHostKind"]] = None, + customer_subnet: Optional[str] = None, + storage_connections: Optional[List[str]] = None, + thread_storage_connections: Optional[List[str]] = None, + vector_store_connections: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword description: The asset description text. + :paramtype description: str + :keyword tags: Tag dictionary. Tags can be added, removed, and updated. + :paramtype tags: dict[str, str] + :keyword ai_services_connections: List of AI services connections. + :paramtype ai_services_connections: list[str] + :keyword capability_host_kind: Kind of this capability host. "Agents" + :paramtype capability_host_kind: str or ~azure.mgmt.cognitiveservices.models.CapabilityHostKind + :keyword customer_subnet: Customer subnet info to help set up this capability host. + :paramtype customer_subnet: str + :keyword storage_connections: List of connection names from those available in the account or + project to be used as a storage resource. + :paramtype storage_connections: list[str] + :keyword thread_storage_connections: List of connection names from those available in the + account or project to be used for Thread storage. + :paramtype thread_storage_connections: list[str] + :keyword vector_store_connections: List of connection names from those available in the account + or project to be used for vector database (e.g. CosmosDB). + :paramtype vector_store_connections: list[str] + """ + super().__init__(description=description, tags=tags, **kwargs) + self.ai_services_connections = ai_services_connections + self.capability_host_kind = capability_host_kind + self.customer_subnet = customer_subnet + self.provisioning_state: Optional[Union[str, "_models.CapabilityHostProvisioningState"]] = None + self.storage_connections = storage_connections + self.thread_storage_connections = thread_storage_connections + self.vector_store_connections = vector_store_connections + + class CapacityConfig(_serialization.Model): """The capacity configuration. @@ -1291,26 +2332,9 @@ def __init__(self, *, tier: Optional[str] = None, count: Optional[int] = None, * super().__init__(**kwargs) self.tier = tier self.count = count - self.quota = None - self.start_date = None - self.end_date = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :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 - """ + self.quota: Optional["_models.CommitmentQuota"] = None + self.start_date: Optional[str] = None + self.end_date: Optional[str] = None class CommitmentPlan(ProxyResource): @@ -1319,7 +2343,7 @@ class CommitmentPlan(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1386,8 +2410,8 @@ def __init__( :paramtype properties: ~azure.mgmt.cognitiveservices.models.CommitmentPlanProperties """ super().__init__(**kwargs) - self.system_data = None - self.etag = None + self.system_data: Optional["_models.SystemData"] = None + self.etag: Optional[str] = None self.kind = kind self.sku = sku self.tags = tags @@ -1401,7 +2425,7 @@ class CommitmentPlanAccountAssociation(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1446,8 +2470,8 @@ def __init__( :paramtype account_id: str """ super().__init__(**kwargs) - self.system_data = None - self.etag = None + self.system_data: Optional["_models.SystemData"] = None + self.etag: Optional[str] = None self.tags = tags self.account_id = account_id @@ -1480,7 +2504,7 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ super().__init__(**kwargs) self.next_link = next_link - self.value = None + self.value: Optional[List["_models.CommitmentPlanAccountAssociation"]] = None class CommitmentPlanAssociation(_serialization.Model): @@ -1538,7 +2562,7 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ super().__init__(**kwargs) self.next_link = next_link - self.value = None + self.value: Optional[List["_models.CommitmentPlan"]] = None class CommitmentPlanProperties(_serialization.Model): @@ -1615,15 +2639,15 @@ def __init__( :paramtype next: ~azure.mgmt.cognitiveservices.models.CommitmentPeriod """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.CommitmentPlanProvisioningState"]] = None self.commitment_plan_guid = commitment_plan_guid self.hosting_model = hosting_model self.plan_type = plan_type self.current = current self.auto_renew = auto_renew self.next = next - self.last = None - self.provisioning_issues = None + self.last: Optional["_models.CommitmentPeriod"] = None + self.provisioning_issues: Optional[List[str]] = None class CommitmentQuota(_serialization.Model): @@ -1636,126 +2660,517 @@ class CommitmentQuota(_serialization.Model): """ _attribute_map = { - "quantity": {"key": "quantity", "type": "int"}, - "unit": {"key": "unit", "type": "str"}, + "quantity": {"key": "quantity", "type": "int"}, + "unit": {"key": "unit", "type": "str"}, + } + + def __init__(self, *, quantity: Optional[int] = None, unit: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword quantity: Commitment quota quantity. + :paramtype quantity: int + :keyword unit: Commitment quota unit. + :paramtype unit: str + """ + super().__init__(**kwargs) + self.quantity = quantity + self.unit = unit + + +class CommitmentTier(_serialization.Model): + """Cognitive Services account commitment tier. + + :ivar kind: The Kind of the resource. + :vartype kind: str + :ivar sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :vartype sku_name: str + :ivar hosting_model: Account hosting model. Known values are: "Web", "ConnectedContainer", + "DisconnectedContainer", and "ProvisionedWeb". + :vartype hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel + :ivar plan_type: Commitment plan type. + :vartype plan_type: str + :ivar tier: Commitment period commitment tier. + :vartype tier: str + :ivar max_count: Commitment period commitment max count. + :vartype max_count: int + :ivar quota: Cognitive Services account commitment quota. + :vartype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota + :ivar cost: Cognitive Services account commitment cost. + :vartype cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + """ + + _attribute_map = { + "kind": {"key": "kind", "type": "str"}, + "sku_name": {"key": "skuName", "type": "str"}, + "hosting_model": {"key": "hostingModel", "type": "str"}, + "plan_type": {"key": "planType", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "max_count": {"key": "maxCount", "type": "int"}, + "quota": {"key": "quota", "type": "CommitmentQuota"}, + "cost": {"key": "cost", "type": "CommitmentCost"}, + } + + def __init__( + self, + *, + kind: Optional[str] = None, + sku_name: Optional[str] = None, + hosting_model: Optional[Union[str, "_models.HostingModel"]] = None, + plan_type: Optional[str] = None, + tier: Optional[str] = None, + max_count: Optional[int] = None, + quota: Optional["_models.CommitmentQuota"] = None, + cost: Optional["_models.CommitmentCost"] = None, + **kwargs: Any + ) -> None: + """ + :keyword kind: The Kind of the resource. + :paramtype kind: str + :keyword sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. + :paramtype sku_name: str + :keyword hosting_model: Account hosting model. Known values are: "Web", "ConnectedContainer", + "DisconnectedContainer", and "ProvisionedWeb". + :paramtype hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel + :keyword plan_type: Commitment plan type. + :paramtype plan_type: str + :keyword tier: Commitment period commitment tier. + :paramtype tier: str + :keyword max_count: Commitment period commitment max count. + :paramtype max_count: int + :keyword quota: Cognitive Services account commitment quota. + :paramtype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota + :keyword cost: Cognitive Services account commitment cost. + :paramtype cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + """ + super().__init__(**kwargs) + self.kind = kind + self.sku_name = sku_name + self.hosting_model = hosting_model + self.plan_type = plan_type + self.tier = tier + self.max_count = max_count + self.quota = quota + self.cost = cost + + +class CommitmentTierListResult(_serialization.Model): + """The list of cognitive services accounts operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar next_link: The link used to get the next page of CommitmentTier. + :vartype next_link: str + :ivar value: Gets the list of Cognitive Services accounts CommitmentTier and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.CommitmentTier] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[CommitmentTier]"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The link used to get the next page of CommitmentTier. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value: Optional[List["_models.CommitmentTier"]] = None + + +class ConnectionAccessKey(_serialization.Model): + """ConnectionAccessKey. + + :ivar access_key_id: + :vartype access_key_id: str + :ivar secret_access_key: + :vartype secret_access_key: str + """ + + _attribute_map = { + "access_key_id": {"key": "accessKeyId", "type": "str"}, + "secret_access_key": {"key": "secretAccessKey", "type": "str"}, + } + + def __init__( + self, *, access_key_id: Optional[str] = None, secret_access_key: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword access_key_id: + :paramtype access_key_id: str + :keyword secret_access_key: + :paramtype secret_access_key: str + """ + super().__init__(**kwargs) + self.access_key_id = access_key_id + self.secret_access_key = secret_access_key + + +class ConnectionAccountKey(_serialization.Model): + """Account key object for connection credential. + + :ivar key: + :vartype key: str + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: + :paramtype key: str + """ + super().__init__(**kwargs) + self.key = key + + +class ConnectionApiKey(_serialization.Model): + """Api key object for connection credential. + + :ivar key: + :vartype key: str + """ + + _attribute_map = { + "key": {"key": "key", "type": "str"}, + } + + def __init__(self, *, key: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword key: + :paramtype key: str + """ + super().__init__(**kwargs) + self.key = key + + +class ConnectionManagedIdentity(_serialization.Model): + """ConnectionManagedIdentity. + + :ivar client_id: + :vartype client_id: str + :ivar resource_id: + :vartype resource_id: str + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, client_id: Optional[str] = None, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword client_id: + :paramtype client_id: str + :keyword resource_id: + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.resource_id = resource_id + + +class ConnectionOAuth2(_serialization.Model): + """ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + + :ivar auth_url: Required by Concur connection category. + :vartype auth_url: str + :ivar client_id: Client id in the format of UUID. + :vartype client_id: str + :ivar client_secret: + :vartype client_secret: str + :ivar developer_token: Required by GoogleAdWords connection category. + :vartype developer_token: str + :ivar password: + :vartype password: str + :ivar refresh_token: Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, + Xero, Zoho + where user needs to get RefreshToken offline. + :vartype refresh_token: str + :ivar tenant_id: Required by QuickBooks and Xero connection categories. + :vartype tenant_id: str + :ivar username: Concur, ServiceNow auth server AccessToken grant type is 'Password' + which requires UsernamePassword. + :vartype username: str + """ + + _attribute_map = { + "auth_url": {"key": "authUrl", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "developer_token": {"key": "developerToken", "type": "str"}, + "password": {"key": "password", "type": "str"}, + "refresh_token": {"key": "refreshToken", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "username": {"key": "username", "type": "str"}, + } + + def __init__( + self, + *, + auth_url: Optional[str] = None, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + developer_token: Optional[str] = None, + password: Optional[str] = None, + refresh_token: Optional[str] = None, + tenant_id: Optional[str] = None, + username: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword auth_url: Required by Concur connection category. + :paramtype auth_url: str + :keyword client_id: Client id in the format of UUID. + :paramtype client_id: str + :keyword client_secret: + :paramtype client_secret: str + :keyword developer_token: Required by GoogleAdWords connection category. + :paramtype developer_token: str + :keyword password: + :paramtype password: str + :keyword refresh_token: Required by GoogleBigQuery, GoogleAdWords, Hubspot, QuickBooks, Square, + Xero, Zoho + where user needs to get RefreshToken offline. + :paramtype refresh_token: str + :keyword tenant_id: Required by QuickBooks and Xero connection categories. + :paramtype tenant_id: str + :keyword username: Concur, ServiceNow auth server AccessToken grant type is 'Password' + which requires UsernamePassword. + :paramtype username: str + """ + super().__init__(**kwargs) + self.auth_url = auth_url + self.client_id = client_id + self.client_secret = client_secret + self.developer_token = developer_token + self.password = password + self.refresh_token = refresh_token + self.tenant_id = tenant_id + self.username = username + + +class ConnectionPersonalAccessToken(_serialization.Model): + """ConnectionPersonalAccessToken. + + :ivar pat: + :vartype pat: str + """ + + _attribute_map = { + "pat": {"key": "pat", "type": "str"}, + } + + def __init__(self, *, pat: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword pat: + :paramtype pat: str + """ + super().__init__(**kwargs) + self.pat = pat + + +class ConnectionPropertiesV2BasicResource(Resource): + """Connection base resource schema. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :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 properties: Connection property base schema. Required. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2 + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "ConnectionPropertiesV2"}, + } + + def __init__(self, *, properties: "_models.ConnectionPropertiesV2", **kwargs: Any) -> None: + """ + :keyword properties: Connection property base schema. Required. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2 + """ + super().__init__(**kwargs) + self.properties = properties + + +class ConnectionPropertiesV2BasicResourceArmPaginatedResult(_serialization.Model): # pylint: disable=name-too-long + """ConnectionPropertiesV2BasicResourceArmPaginatedResult. + + :ivar next_link: + :vartype next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + """ + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[ConnectionPropertiesV2BasicResource]"}, + } + + def __init__( + self, + *, + next_link: Optional[str] = None, + value: Optional[List["_models.ConnectionPropertiesV2BasicResource"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword next_link: + :paramtype next_link: str + :keyword value: + :paramtype value: + list[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value = value + + +class ConnectionServicePrincipal(_serialization.Model): + """ConnectionServicePrincipal. + + :ivar client_id: + :vartype client_id: str + :ivar client_secret: + :vartype client_secret: str + :ivar tenant_id: + :vartype tenant_id: str + """ + + _attribute_map = { + "client_id": {"key": "clientId", "type": "str"}, + "client_secret": {"key": "clientSecret", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + tenant_id: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword client_id: + :paramtype client_id: str + :keyword client_secret: + :paramtype client_secret: str + :keyword tenant_id: + :paramtype tenant_id: str + """ + super().__init__(**kwargs) + self.client_id = client_id + self.client_secret = client_secret + self.tenant_id = tenant_id + + +class ConnectionSharedAccessSignature(_serialization.Model): + """ConnectionSharedAccessSignature. + + :ivar sas: + :vartype sas: str + """ + + _attribute_map = { + "sas": {"key": "sas", "type": "str"}, } - def __init__(self, *, quantity: Optional[int] = None, unit: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, sas: Optional[str] = None, **kwargs: Any) -> None: """ - :keyword quantity: Commitment quota quantity. - :paramtype quantity: int - :keyword unit: Commitment quota unit. - :paramtype unit: str + :keyword sas: + :paramtype sas: str """ super().__init__(**kwargs) - self.quantity = quantity - self.unit = unit + self.sas = sas -class CommitmentTier(_serialization.Model): - """Cognitive Services account commitment tier. +class ConnectionUpdateContent(_serialization.Model): + """The properties that the Cognitive services connection will be updated with. - :ivar kind: The Kind of the resource. - :vartype kind: str - :ivar sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :vartype sku_name: str - :ivar hosting_model: Account hosting model. Known values are: "Web", "ConnectedContainer", - "DisconnectedContainer", and "ProvisionedWeb". - :vartype hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel - :ivar plan_type: Commitment plan type. - :vartype plan_type: str - :ivar tier: Commitment period commitment tier. - :vartype tier: str - :ivar max_count: Commitment period commitment max count. - :vartype max_count: int - :ivar quota: Cognitive Services account commitment quota. - :vartype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota - :ivar cost: Cognitive Services account commitment cost. - :vartype cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + :ivar properties: The properties that the Cognitive services connection will be updated with. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2 """ _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "sku_name": {"key": "skuName", "type": "str"}, - "hosting_model": {"key": "hostingModel", "type": "str"}, - "plan_type": {"key": "planType", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "max_count": {"key": "maxCount", "type": "int"}, - "quota": {"key": "quota", "type": "CommitmentQuota"}, - "cost": {"key": "cost", "type": "CommitmentCost"}, + "properties": {"key": "properties", "type": "ConnectionPropertiesV2"}, } - def __init__( - self, - *, - kind: Optional[str] = None, - sku_name: Optional[str] = None, - hosting_model: Optional[Union[str, "_models.HostingModel"]] = None, - plan_type: Optional[str] = None, - tier: Optional[str] = None, - max_count: Optional[int] = None, - quota: Optional["_models.CommitmentQuota"] = None, - cost: Optional["_models.CommitmentCost"] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, properties: Optional["_models.ConnectionPropertiesV2"] = None, **kwargs: Any) -> None: """ - :keyword kind: The Kind of the resource. - :paramtype kind: str - :keyword sku_name: The name of the SKU. Ex - P3. It is typically a letter+number code. - :paramtype sku_name: str - :keyword hosting_model: Account hosting model. Known values are: "Web", "ConnectedContainer", - "DisconnectedContainer", and "ProvisionedWeb". - :paramtype hosting_model: str or ~azure.mgmt.cognitiveservices.models.HostingModel - :keyword plan_type: Commitment plan type. - :paramtype plan_type: str - :keyword tier: Commitment period commitment tier. - :paramtype tier: str - :keyword max_count: Commitment period commitment max count. - :paramtype max_count: int - :keyword quota: Cognitive Services account commitment quota. - :paramtype quota: ~azure.mgmt.cognitiveservices.models.CommitmentQuota - :keyword cost: Cognitive Services account commitment cost. - :paramtype cost: ~azure.mgmt.cognitiveservices.models.CommitmentCost + :keyword properties: The properties that the Cognitive services connection will be updated + with. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2 """ super().__init__(**kwargs) - self.kind = kind - self.sku_name = sku_name - self.hosting_model = hosting_model - self.plan_type = plan_type - self.tier = tier - self.max_count = max_count - self.quota = quota - self.cost = cost - + self.properties = properties -class CommitmentTierListResult(_serialization.Model): - """The list of cognitive services accounts operation response. - Variables are only populated by the server, and will be ignored when sending a request. +class ConnectionUsernamePassword(_serialization.Model): + """ConnectionUsernamePassword. - :ivar next_link: The link used to get the next page of CommitmentTier. - :vartype next_link: str - :ivar value: Gets the list of Cognitive Services accounts CommitmentTier and their properties. - :vartype value: list[~azure.mgmt.cognitiveservices.models.CommitmentTier] + :ivar password: + :vartype password: str + :ivar security_token: Optional, required by connections like SalesForce for extra security in + addition to UsernamePassword. + :vartype security_token: str + :ivar username: + :vartype username: str """ - _validation = { - "value": {"readonly": True}, - } - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[CommitmentTier]"}, + "password": {"key": "password", "type": "str"}, + "security_token": {"key": "securityToken", "type": "str"}, + "username": {"key": "username", "type": "str"}, } - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + password: Optional[str] = None, + security_token: Optional[str] = None, + username: Optional[str] = None, + **kwargs: Any + ) -> None: """ - :keyword next_link: The link used to get the next page of CommitmentTier. - :paramtype next_link: str + :keyword password: + :paramtype password: str + :keyword security_token: Optional, required by connections like SalesForce for extra security + in addition to UsernamePassword. + :paramtype security_token: str + :keyword username: + :paramtype username: str """ super().__init__(**kwargs) - self.next_link = next_link - self.value = None + self.password = password + self.security_token = security_token + self.username = username class RaiBlocklistConfig(_serialization.Model): @@ -1823,13 +3238,197 @@ def __init__( self.source = source +class CustomKeys(_serialization.Model): + """Custom Keys credential object. + + :ivar keys: Dictionary of :code:``. + :vartype keys: dict[str, str] + """ + + _attribute_map = { + "keys": {"key": "keys", "type": "{str}"}, + } + + def __init__(self, *, keys: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword keys: Dictionary of :code:``. + :paramtype keys: dict[str, str] + """ + super().__init__(**kwargs) + self.keys = keys + + +class CustomKeysConnectionProperties(ConnectionPropertiesV2): + """Category:= CustomKeys + AuthType:= CustomKeys (as type discriminator) + Credentials:= {CustomKeys} as CustomKeys + Target:= {any value} + Use Metadata property bag for ApiVersion and other metadata fields. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: Custom Keys credential object. + :vartype credentials: ~azure.mgmt.cognitiveservices.models.CustomKeys + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "CustomKeys"}, + } + + 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.CustomKeys"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: Custom Keys credential object. + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.CustomKeys + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "CustomKeys" + self.credentials = credentials + + class DefenderForAISetting(ProxyResource): """The Defender for AI resource. Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1880,8 +3479,8 @@ def __init__( :paramtype state: str or ~azure.mgmt.cognitiveservices.models.DefenderForAISettingState """ super().__init__(**kwargs) - self.system_data = None - self.etag = None + self.system_data: Optional["_models.SystemData"] = None + self.etag: Optional[str] = None self.tags = tags self.state = state @@ -1924,7 +3523,7 @@ class Deployment(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1980,8 +3579,8 @@ def __init__( """ super().__init__(**kwargs) self.sku = sku - self.system_data = None - self.etag = None + self.system_data: Optional["_models.SystemData"] = None + self.etag: Optional[str] = None self.tags = tags self.properties = properties @@ -2046,10 +3645,10 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ super().__init__(**kwargs) self.next_link = next_link - self.value = None + self.value: Optional[List["_models.Deployment"]] = None -class DeploymentProperties(_serialization.Model): # pylint: disable=too-many-instance-attributes +class DeploymentProperties(_serialization.Model): """Properties of Cognitive Services account deployment. Variables are only populated by the server, and will be ignored when sending a request. @@ -2084,6 +3683,10 @@ class DeploymentProperties(_serialization.Model): # pylint: disable=too-many-in :vartype capacity_settings: ~azure.mgmt.cognitiveservices.models.DeploymentCapacitySettings :ivar parent_deployment_name: The name of parent deployment. :vartype parent_deployment_name: str + :ivar spillover_deployment_name: Specifies the deployment name that should serve requests when + the request would have otherwise been throttled due to reaching current deployment throughput + limit. + :vartype spillover_deployment_name: str """ _validation = { @@ -2107,6 +3710,7 @@ class DeploymentProperties(_serialization.Model): # pylint: disable=too-many-in "current_capacity": {"key": "currentCapacity", "type": "int"}, "capacity_settings": {"key": "capacitySettings", "type": "DeploymentCapacitySettings"}, "parent_deployment_name": {"key": "parentDeploymentName", "type": "str"}, + "spillover_deployment_name": {"key": "spilloverDeploymentName", "type": "str"}, } def __init__( @@ -2119,6 +3723,7 @@ def __init__( current_capacity: Optional[int] = None, capacity_settings: Optional["_models.DeploymentCapacitySettings"] = None, parent_deployment_name: Optional[str] = None, + spillover_deployment_name: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -2139,20 +3744,25 @@ def __init__( :paramtype capacity_settings: ~azure.mgmt.cognitiveservices.models.DeploymentCapacitySettings :keyword parent_deployment_name: The name of parent deployment. :paramtype parent_deployment_name: str + :keyword spillover_deployment_name: Specifies the deployment name that should serve requests + when the request would have otherwise been throttled due to reaching current deployment + throughput limit. + :paramtype spillover_deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.DeploymentProvisioningState"]] = None self.model = model self.scale_settings = scale_settings - self.capabilities = None + self.capabilities: Optional[Dict[str, str]] = None self.rai_policy_name = rai_policy_name - self.call_rate_limit = None - self.rate_limits = None + self.call_rate_limit: Optional["_models.CallRateLimit"] = None + self.rate_limits: Optional[List["_models.ThrottlingRule"]] = None self.version_upgrade_option = version_upgrade_option - self.dynamic_throttling_enabled = None + self.dynamic_throttling_enabled: Optional[bool] = None self.current_capacity = current_capacity self.capacity_settings = capacity_settings self.parent_deployment_name = parent_deployment_name + self.spillover_deployment_name = spillover_deployment_name class DeploymentScaleSettings(_serialization.Model): @@ -2196,7 +3806,7 @@ def __init__( super().__init__(**kwargs) self.scale_type = scale_type self.capacity = capacity - self.active_capacity = None + self.active_capacity: Optional[int] = None class DeploymentSkuListResult(_serialization.Model): @@ -2226,7 +3836,7 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: """ super().__init__(**kwargs) self.next_link = next_link - self.value = None + self.value: Optional[List["_models.SkuResource"]] = None class DomainAvailability(_serialization.Model): @@ -2322,7 +3932,7 @@ class EncryptionScope(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2371,8 +3981,8 @@ def __init__( :paramtype properties: ~azure.mgmt.cognitiveservices.models.EncryptionScopeProperties """ super().__init__(**kwargs) - self.system_data = None - self.etag = None + self.system_data: Optional["_models.SystemData"] = None + self.etag: Optional[str] = None self.tags = tags self.properties = properties @@ -2453,7 +4063,7 @@ def __init__( :paramtype state: str or ~azure.mgmt.cognitiveservices.models.EncryptionScopeState """ super().__init__(key_vault_properties=key_vault_properties, key_source=key_source, **kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.EncryptionScopeProvisioningState"]] = None self.state = state @@ -2481,8 +4091,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -2521,11 +4131,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -2563,7 +4173,7 @@ class Identity(_serialization.Model): :vartype principal_id: str :ivar user_assigned_identities: 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}. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. :vartype user_assigned_identities: dict[str, ~azure.mgmt.cognitiveservices.models.UserAssignedIdentity] """ @@ -2593,14 +4203,14 @@ def __init__( :paramtype type: str or ~azure.mgmt.cognitiveservices.models.ResourceIdentityType :keyword user_assigned_identities: 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}. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.cognitiveservices.models.UserAssignedIdentity] """ super().__init__(**kwargs) self.type = type - self.tenant_id = None - self.principal_id = None + self.tenant_id: Optional[str] = None + self.principal_id: Optional[str] = None self.user_assigned_identities = user_assigned_identities @@ -2678,6 +4288,166 @@ def __init__( self.identity_client_id = identity_client_id +class ManagedIdentityAuthTypeConnectionProperties(ConnectionPropertiesV2): # pylint: disable=name-too-long + """ManagedIdentityAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionManagedIdentity + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionManagedIdentity"}, + } + + 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.ConnectionManagedIdentity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionManagedIdentity + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ManagedIdentity" + self.credentials = credentials + + class MetricName(_serialization.Model): """A metric name. @@ -2850,7 +4620,7 @@ class ModelCapacityListResultValueItem(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3091,6 +4861,53 @@ def __init__( self.regions = regions +class NetworkInjections(_serialization.Model): + """Specifies in AI Foundry where virtual network injection occurs to secure scenarios like Agents + entirely within the user's private network, eliminating public internet exposure while + maintaining control over network configurations and resources. + + :ivar scenario: Specifies what features in AI Foundry network injection applies to. Currently + only supports 'agent' for agent scenarios. 'none' means no network injection. Known values are: + "none" and "agent". + :vartype scenario: str or ~azure.mgmt.cognitiveservices.models.ScenarioType + :ivar subnet_arm_id: Specify the subnet for which your Agent Client is injected into. + :vartype subnet_arm_id: str + :ivar use_microsoft_managed_network: Boolean to enable Microsoft Managed Network for subnet + delegation. + :vartype use_microsoft_managed_network: bool + """ + + _attribute_map = { + "scenario": {"key": "scenario", "type": "str"}, + "subnet_arm_id": {"key": "subnetArmId", "type": "str"}, + "use_microsoft_managed_network": {"key": "useMicrosoftManagedNetwork", "type": "bool"}, + } + + def __init__( + self, + *, + scenario: Optional[Union[str, "_models.ScenarioType"]] = None, + subnet_arm_id: Optional[str] = None, + use_microsoft_managed_network: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword scenario: Specifies what features in AI Foundry network injection applies to. + Currently only supports 'agent' for agent scenarios. 'none' means no network injection. Known + values are: "none" and "agent". + :paramtype scenario: str or ~azure.mgmt.cognitiveservices.models.ScenarioType + :keyword subnet_arm_id: Specify the subnet for which your Agent Client is injected into. + :paramtype subnet_arm_id: str + :keyword use_microsoft_managed_network: Boolean to enable Microsoft Managed Network for subnet + delegation. + :paramtype use_microsoft_managed_network: bool + """ + super().__init__(**kwargs) + self.scenario = scenario + self.subnet_arm_id = subnet_arm_id + self.use_microsoft_managed_network = use_microsoft_managed_network + + class NetworkRuleSet(_serialization.Model): """A set of rules governing the network accessibility. @@ -3302,7 +5119,7 @@ class NetworkSecurityPerimeterConfiguration(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3456,7 +5273,7 @@ def __init__( :paramtype profile: ~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterProfileInfo """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.provisioning_issues = provisioning_issues self.network_security_perimeter = network_security_perimeter self.resource_association = resource_association @@ -3480,42 +5297,357 @@ class NetworkSecurityPerimeterProfileInfo(_serialization.Model): """ _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_rules_version": {"key": "accessRulesVersion", "type": "int"}, - "access_rules": {"key": "accessRules", "type": "[NetworkSecurityPerimeterAccessRule]"}, - "diagnostic_settings_version": {"key": "diagnosticSettingsVersion", "type": "int"}, - "enabled_log_categories": {"key": "enabledLogCategories", "type": "[str]"}, + "name": {"key": "name", "type": "str"}, + "access_rules_version": {"key": "accessRulesVersion", "type": "int"}, + "access_rules": {"key": "accessRules", "type": "[NetworkSecurityPerimeterAccessRule]"}, + "diagnostic_settings_version": {"key": "diagnosticSettingsVersion", "type": "int"}, + "enabled_log_categories": {"key": "enabledLogCategories", "type": "[str]"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + access_rules_version: Optional[int] = None, + access_rules: Optional[List["_models.NetworkSecurityPerimeterAccessRule"]] = None, + diagnostic_settings_version: Optional[int] = None, + enabled_log_categories: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: Name of the resource profile. + :paramtype name: str + :keyword access_rules_version: Access rules version of the resource profile. + :paramtype access_rules_version: int + :keyword access_rules: + :paramtype access_rules: + list[~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterAccessRule] + :keyword diagnostic_settings_version: Current diagnostic settings version. + :paramtype diagnostic_settings_version: int + :keyword enabled_log_categories: List of enabled log categories. + :paramtype enabled_log_categories: list[str] + """ + super().__init__(**kwargs) + self.name = name + self.access_rules_version = access_rules_version + self.access_rules = access_rules + self.diagnostic_settings_version = diagnostic_settings_version + self.enabled_log_categories = enabled_log_categories + + +class NoneAuthTypeConnectionProperties(ConnectionPropertiesV2): + """NoneAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + } + + 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, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "None" + + +class OAuth2AuthTypeConnectionProperties(ConnectionPropertiesV2): + """OAuth2AuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionOAuth2 + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionOAuth2"}, } def __init__( self, *, - name: Optional[str] = None, - access_rules_version: Optional[int] = None, - access_rules: Optional[List["_models.NetworkSecurityPerimeterAccessRule"]] = None, - diagnostic_settings_version: Optional[int] = None, - enabled_log_categories: Optional[List[str]] = None, + 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.ConnectionOAuth2"] = None, **kwargs: Any ) -> None: """ - :keyword name: Name of the resource profile. - :paramtype name: str - :keyword access_rules_version: Access rules version of the resource profile. - :paramtype access_rules_version: int - :keyword access_rules: - :paramtype access_rules: - list[~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterAccessRule] - :keyword diagnostic_settings_version: Current diagnostic settings version. - :paramtype diagnostic_settings_version: int - :keyword enabled_log_categories: List of enabled log categories. - :paramtype enabled_log_categories: list[str] + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: ClientId and ClientSecret are required. Other properties are optional + depending on each OAuth2 provider's implementation. + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionOAuth2 """ - super().__init__(**kwargs) - self.name = name - self.access_rules_version = access_rules_version - self.access_rules = access_rules - self.diagnostic_settings_version = diagnostic_settings_version - self.enabled_log_categories = enabled_log_categories + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "OAuth2" + self.credentials = credentials class Operation(_serialization.Model): @@ -3561,11 +5693,11 @@ def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kw :paramtype display: ~azure.mgmt.cognitiveservices.models.OperationDisplay """ super().__init__(**kwargs) - self.name = None - self.is_data_action = None + self.name: Optional[str] = None + self.is_data_action: Optional[bool] = None self.display = display - self.origin = None - self.action_type = None + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None class OperationDisplay(_serialization.Model): @@ -3604,10 +5736,10 @@ class OperationDisplay(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None class OperationListResult(_serialization.Model): @@ -3635,8 +5767,168 @@ class OperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value: Optional[List["_models.Operation"]] = None + self.next_link: Optional[str] = None + + +class PATAuthTypeConnectionProperties(ConnectionPropertiesV2): + """PATAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionPersonalAccessToken + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionPersonalAccessToken"}, + } + + 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, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionPersonalAccessToken + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "PAT" + self.credentials = credentials class PatchResourceTags(_serialization.Model): @@ -3707,7 +5999,7 @@ class PrivateEndpoint(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class PrivateEndpointConnection(AzureEntityResource): @@ -3716,7 +6008,7 @@ class PrivateEndpointConnection(AzureEntityResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3766,7 +6058,7 @@ def __init__( """ super().__init__(**kwargs) self.properties = properties - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None self.location = location @@ -3847,7 +6139,7 @@ def __init__( super().__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None self.group_ids = group_ids @@ -3857,7 +6149,7 @@ class PrivateLinkResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -3944,10 +6236,10 @@ def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: :paramtype required_zone_names: list[str] """ super().__init__(**kwargs) - self.group_id = None - self.required_members = None + self.group_id: Optional[str] = None + self.required_members: Optional[List[str]] = None self.required_zone_names = required_zone_names - self.display_name = None + self.display_name: Optional[str] = None class PrivateLinkServiceConnectionState(_serialization.Model): @@ -3996,6 +6288,159 @@ def __init__( self.actions_required = actions_required +class Project(AzureEntityResource): + """Cognitive Services project is an Azure resource representing the provisioned account's project, + it's type, location and SKU. + + Variables are only populated by the server, and will be ignored when sending a request. + + :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 etag: Resource Etag. + :vartype etag: str + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.cognitiveservices.models.Identity + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.cognitiveservices.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar properties: Properties of Cognitive Services project. + :vartype properties: ~azure.mgmt.cognitiveservices.models.ProjectProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "etag": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "etag": {"key": "etag", "type": "str"}, + "identity": {"key": "identity", "type": "Identity"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "ProjectProperties"}, + } + + def __init__( + self, + *, + identity: Optional["_models.Identity"] = None, + tags: Optional[Dict[str, str]] = None, + location: Optional[str] = None, + properties: Optional["_models.ProjectProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword identity: Identity for the resource. + :paramtype identity: ~azure.mgmt.cognitiveservices.models.Identity + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword properties: Properties of Cognitive Services project. + :paramtype properties: ~azure.mgmt.cognitiveservices.models.ProjectProperties + """ + super().__init__(**kwargs) + self.identity = identity + self.system_data: Optional["_models.SystemData"] = None + self.tags = tags + self.location = location + self.properties = properties + + +class ProjectListResult(_serialization.Model): + """The list of cognitive services projects operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar next_link: The link used to get the next page of projects. + :vartype next_link: str + :ivar value: Gets the list of Cognitive Services projects and their properties. + :vartype value: list[~azure.mgmt.cognitiveservices.models.Project] + """ + + _validation = { + "value": {"readonly": True}, + } + + _attribute_map = { + "next_link": {"key": "nextLink", "type": "str"}, + "value": {"key": "value", "type": "[Project]"}, + } + + def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword next_link: The link used to get the next page of projects. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.next_link = next_link + self.value: Optional[List["_models.Project"]] = None + + +class ProjectProperties(_serialization.Model): + """Properties of Cognitive Services Project'. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Gets the status of the cognitive services project at the time the + operation was called. Known values are: "Accepted", "Creating", "Deleting", "Moving", "Failed", + "Succeeded", "ResolvingDNS", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.cognitiveservices.models.ProvisioningState + :ivar display_name: The display name of the Cognitive Services Project. + :vartype display_name: str + :ivar description: The description of the Cognitive Services Project. + :vartype description: str + :ivar endpoints: The list of endpoint for this Cognitive Services Project. + :vartype endpoints: dict[str, str] + :ivar is_default: Indicates whether the project is the default project for the account. + :vartype is_default: bool + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "endpoints": {"readonly": True}, + "is_default": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "endpoints": {"key": "endpoints", "type": "{str}"}, + "is_default": {"key": "isDefault", "type": "bool"}, + } + + def __init__(self, *, display_name: Optional[str] = None, description: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword display_name: The display name of the Cognitive Services Project. + :paramtype display_name: str + :keyword description: The description of the Cognitive Services Project. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.display_name = display_name + self.description = description + self.endpoints: Optional[Dict[str, str]] = None + self.is_default: Optional[bool] = None + + class ProvisioningIssue(_serialization.Model): """ProvisioningIssue. @@ -4130,7 +6575,7 @@ class RaiBlocklist(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4179,8 +6624,8 @@ def __init__( :paramtype properties: ~azure.mgmt.cognitiveservices.models.RaiBlocklistProperties """ super().__init__(**kwargs) - self.system_data = None - self.etag = None + self.system_data: Optional["_models.SystemData"] = None + self.etag: Optional[str] = None self.tags = tags self.properties = properties @@ -4191,7 +6636,7 @@ class RaiBlocklistItem(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4240,8 +6685,8 @@ def __init__( :paramtype properties: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItemProperties """ super().__init__(**kwargs) - self.system_data = None - self.etag = None + self.system_data: Optional["_models.SystemData"] = None + self.etag: Optional[str] = None self.tags = tags self.properties = properties @@ -4390,7 +6835,7 @@ class RaiContentFilter(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4532,7 +6977,7 @@ class RaiPolicy(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -4581,8 +7026,8 @@ def __init__( :paramtype properties: ~azure.mgmt.cognitiveservices.models.RaiPolicyProperties """ super().__init__(**kwargs) - self.system_data = None - self.etag = None + self.system_data: Optional["_models.SystemData"] = None + self.etag: Optional[str] = None self.tags = tags self.properties = properties @@ -4680,7 +7125,7 @@ class RaiPolicyProperties(_serialization.Model): :ivar type: Content Filters policy type. Known values are: "UserManaged" and "SystemManaged". :vartype type: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyType :ivar mode: Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, - Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is + Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-06-01. It is the same as 'Deferred' in previous version. Known values are: "Default", "Deferred", "Blocking", and "Asynchronous_filter". :vartype mode: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyMode @@ -4715,7 +7160,7 @@ def __init__( ) -> None: """ :keyword mode: Rai policy mode. The enum value mapping is as below: Default = 0, Deferred=1, - Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2024-10-01. It is + Blocking=2, Asynchronous_filter =3. Please use 'Asynchronous_filter' after 2025-06-01. It is the same as 'Deferred' in previous version. Known values are: "Default", "Deferred", "Blocking", and "Asynchronous_filter". :paramtype mode: str or ~azure.mgmt.cognitiveservices.models.RaiPolicyMode @@ -4727,7 +7172,7 @@ def __init__( :paramtype custom_blocklists: list[~azure.mgmt.cognitiveservices.models.CustomBlocklistConfig] """ super().__init__(**kwargs) - self.type = None + self.type: Optional[Union[str, "_models.RaiPolicyType"]] = None self.mode = mode self.base_policy_name = base_policy_name self.content_filters = content_filters @@ -5001,6 +7446,326 @@ def __init__( self.reason_code = reason_code +class SASAuthTypeConnectionProperties(ConnectionPropertiesV2): + """SASAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionSharedAccessSignature + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionSharedAccessSignature"}, + } + + 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.ConnectionSharedAccessSignature"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionSharedAccessSignature + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "SAS" + self.credentials = credentials + + +class ServicePrincipalAuthTypeConnectionProperties(ConnectionPropertiesV2): # pylint: disable=name-too-long + """ServicePrincipalAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionServicePrincipal + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionServicePrincipal"}, + } + + 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.ConnectionServicePrincipal"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionServicePrincipal + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "ServicePrincipal" + self.credentials = credentials + + class Sku(_serialization.Model): """The resource model definition representing SKU. @@ -5501,16 +8266,176 @@ class UserAssignedIdentity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None + + +class UsernamePasswordAuthTypeConnectionProperties(ConnectionPropertiesV2): # pylint: disable=name-too-long + """UsernamePasswordAuthTypeConnectionProperties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar auth_type: Authentication type of the connection target. Required. Known values are: + "PAT", "ManagedIdentity", "UsernamePassword", "None", "SAS", "AccountKey", "ServicePrincipal", + "AccessKey", "ApiKey", "CustomKeys", "OAuth2", and "AAD". + :vartype auth_type: str or ~azure.mgmt.cognitiveservices.models.ConnectionAuthType + :ivar category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :vartype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :ivar created_by_workspace_arm_id: + :vartype created_by_workspace_arm_id: str + :ivar error: Provides the error message if the connection fails. + :vartype error: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime + :ivar group: Group based on connection category. Known values are: "Azure", "AzureAI", + "Database", "NoSQL", "File", "GenericProtocol", and "ServicesAndApps". + :vartype group: str or ~azure.mgmt.cognitiveservices.models.ConnectionGroup + :ivar is_shared_to_all: + :vartype is_shared_to_all: bool + :ivar metadata: Store user metadata for this connection. + :vartype metadata: dict[str, str] + :ivar pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :vartype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :ivar pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :vartype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :ivar shared_user_list: + :vartype shared_user_list: list[str] + :ivar target: The connection URL to be used. + :vartype target: str + :ivar use_workspace_managed_identity: + :vartype use_workspace_managed_identity: bool + :ivar credentials: + :vartype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionUsernamePassword + """ + + _validation = { + "auth_type": {"required": True}, + "created_by_workspace_arm_id": {"readonly": True}, + "group": {"readonly": True}, + } + + _attribute_map = { + "auth_type": {"key": "authType", "type": "str"}, + "category": {"key": "category", "type": "str"}, + "created_by_workspace_arm_id": {"key": "createdByWorkspaceArmId", "type": "str"}, + "error": {"key": "error", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, + "group": {"key": "group", "type": "str"}, + "is_shared_to_all": {"key": "isSharedToAll", "type": "bool"}, + "metadata": {"key": "metadata", "type": "{str}"}, + "pe_requirement": {"key": "peRequirement", "type": "str"}, + "pe_status": {"key": "peStatus", "type": "str"}, + "shared_user_list": {"key": "sharedUserList", "type": "[str]"}, + "target": {"key": "target", "type": "str"}, + "use_workspace_managed_identity": {"key": "useWorkspaceManagedIdentity", "type": "bool"}, + "credentials": {"key": "credentials", "type": "ConnectionUsernamePassword"}, + } + + 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.ConnectionUsernamePassword"] = None, + **kwargs: Any + ) -> None: + """ + :keyword category: Category of the connection. Known values are: "PythonFeed", + "ContainerRegistry", "Git", "S3", "Snowflake", "AzureSqlDb", "AzureSynapseAnalytics", + "AzureMySqlDb", "AzurePostgresDb", "ADLSGen2", "Redis", "ApiKey", "AzureOpenAI", "AIServices", + "CognitiveSearch", "CognitiveService", "CustomKeys", "AzureBlob", "AzureOneLake", "CosmosDb", + "CosmosDbMongoDbApi", "AzureDataExplorer", "AzureMariaDb", "AzureDatabricksDeltaLake", + "AzureSqlMi", "AzureTableStorage", "AmazonRdsForOracle", "AmazonRdsForSqlServer", + "AmazonRedshift", "Db2", "Drill", "GoogleBigQuery", "Greenplum", "Hbase", "Hive", "Impala", + "Informix", "MariaDb", "MicrosoftAccess", "MySql", "Netezza", "Oracle", "Phoenix", + "PostgreSql", "Presto", "SapOpenHub", "SapBw", "SapHana", "SapTable", "Spark", "SqlServer", + "Sybase", "Teradata", "Vertica", "Pinecone", "Cassandra", "Couchbase", "MongoDbV2", + "MongoDbAtlas", "AmazonS3Compatible", "FileServer", "FtpServer", "GoogleCloudStorage", "Hdfs", + "OracleCloudStorage", "Sftp", "GenericHttp", "ODataRest", "Odbc", "GenericRest", "AmazonMws", + "Concur", "Dynamics", "DynamicsAx", "DynamicsCrm", "GoogleAdWords", "Hubspot", "Jira", + "Magento", "Marketo", "Office365", "Eloqua", "Responsys", "OracleServiceCloud", "PayPal", + "QuickBooks", "Salesforce", "SalesforceServiceCloud", "SalesforceMarketingCloud", + "SapCloudForCustomer", "SapEcc", "ServiceNow", "SharePointOnlineList", "Shopify", "Square", + "WebTable", "Xero", "Zoho", "GenericContainerRegistry", "Elasticsearch", "OpenAI", "Serp", + "BingLLMSearch", "Serverless", and "ManagedOnlineEndpoint". + :paramtype category: str or ~azure.mgmt.cognitiveservices.models.ConnectionCategory + :keyword error: Provides the error message if the connection fails. + :paramtype error: str + :keyword expiry_time: + :paramtype expiry_time: ~datetime.datetime + :keyword is_shared_to_all: + :paramtype is_shared_to_all: bool + :keyword metadata: Store user metadata for this connection. + :paramtype metadata: dict[str, str] + :keyword pe_requirement: Specifies how private endpoints are used with this connection: + 'Required', 'NotRequired', or 'NotApplicable'. Known values are: "Required", "NotRequired", and + "NotApplicable". + :paramtype pe_requirement: str or ~azure.mgmt.cognitiveservices.models.ManagedPERequirement + :keyword pe_status: Specifies the status of private endpoints for this connection: 'Inactive', + 'Active', or 'NotApplicable'. Known values are: "Inactive", "Active", and "NotApplicable". + :paramtype pe_status: str or ~azure.mgmt.cognitiveservices.models.ManagedPEStatus + :keyword shared_user_list: + :paramtype shared_user_list: list[str] + :keyword target: The connection URL to be used. + :paramtype target: str + :keyword use_workspace_managed_identity: + :paramtype use_workspace_managed_identity: bool + :keyword credentials: + :paramtype credentials: ~azure.mgmt.cognitiveservices.models.ConnectionUsernamePassword + """ + super().__init__( + category=category, + error=error, + expiry_time=expiry_time, + is_shared_to_all=is_shared_to_all, + metadata=metadata, + pe_requirement=pe_requirement, + pe_status=pe_status, + shared_user_list=shared_user_list, + target=target, + use_workspace_managed_identity=use_workspace_managed_identity, + **kwargs + ) + self.auth_type: str = "UsernamePassword" + self.credentials = credentials class UserOwnedAmlWorkspace(_serialization.Model): - """The user owned AML workspace for Cognitive Services account. + """The user owned AML account for Cognitive Services account. - :ivar resource_id: Full resource id of a AML workspace resource. + :ivar resource_id: Full resource id of a AML account resource. :vartype resource_id: str - :ivar identity_client_id: Identity Client id of a AML workspace resource. + :ivar identity_client_id: Identity Client id of a AML account resource. :vartype identity_client_id: str """ @@ -5523,9 +8448,9 @@ def __init__( self, *, resource_id: Optional[str] = None, identity_client_id: Optional[str] = None, **kwargs: Any ) -> None: """ - :keyword resource_id: Full resource id of a AML workspace resource. + :keyword resource_id: Full resource id of a AML account resource. :paramtype resource_id: str - :keyword identity_client_id: Identity Client id of a AML workspace resource. + :keyword identity_client_id: Identity Client id of a AML account resource. :paramtype identity_client_id: str """ super().__init__(**kwargs) @@ -5596,7 +8521,7 @@ def __init__( ) -> None: """ :keyword id: Full resource id of a vnet subnet, such as - '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. # pylint: disable=line-too-long + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. Required. :paramtype id: str :keyword state: Gets the state of virtual network rule. 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 fdaa24c0f86a..e1205acdd6b3 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,31 +6,42 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._accounts_operations import AccountsOperations -from ._deleted_accounts_operations import DeletedAccountsOperations -from ._resource_skus_operations import ResourceSkusOperations -from ._usages_operations import UsagesOperations -from ._operations import Operations -from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin -from ._commitment_tiers_operations import CommitmentTiersOperations -from ._models_operations import ModelsOperations -from ._location_based_model_capacities_operations import LocationBasedModelCapacitiesOperations -from ._model_capacities_operations import ModelCapacitiesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._deployments_operations import DeploymentsOperations -from ._commitment_plans_operations import CommitmentPlansOperations -from ._encryption_scopes_operations import EncryptionScopesOperations -from ._rai_policies_operations import RaiPoliciesOperations -from ._rai_blocklists_operations import RaiBlocklistsOperations -from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations -from ._rai_content_filters_operations import RaiContentFiltersOperations -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations -from ._defender_for_ai_settings_operations import DefenderForAISettingsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._accounts_operations import AccountsOperations # type: ignore +from ._deleted_accounts_operations import DeletedAccountsOperations # type: ignore +from ._resource_skus_operations import ResourceSkusOperations # type: ignore +from ._usages_operations import UsagesOperations # type: ignore +from ._operations import Operations # type: ignore +from ._cognitive_services_management_client_operations import CognitiveServicesManagementClientOperationsMixin # type: ignore +from ._commitment_tiers_operations import CommitmentTiersOperations # type: ignore +from ._models_operations import ModelsOperations # type: ignore +from ._location_based_model_capacities_operations import LocationBasedModelCapacitiesOperations # type: ignore +from ._model_capacities_operations import ModelCapacitiesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore +from ._deployments_operations import DeploymentsOperations # type: ignore +from ._commitment_plans_operations import CommitmentPlansOperations # type: ignore +from ._encryption_scopes_operations import EncryptionScopesOperations # type: ignore +from ._rai_policies_operations import RaiPoliciesOperations # type: ignore +from ._rai_blocklists_operations import RaiBlocklistsOperations # type: ignore +from ._rai_blocklist_items_operations import RaiBlocklistItemsOperations # type: ignore +from ._rai_content_filters_operations import RaiContentFiltersOperations # type: ignore +from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._defender_for_ai_settings_operations import DefenderForAISettingsOperations # type: ignore +from ._projects_operations import ProjectsOperations # type: ignore +from ._account_connections_operations import AccountConnectionsOperations # type: ignore +from ._project_connections_operations import ProjectConnectionsOperations # type: ignore +from ._account_capability_hosts_operations import AccountCapabilityHostsOperations # type: ignore +from ._project_capability_hosts_operations import ProjectCapabilityHostsOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -54,6 +66,11 @@ "RaiContentFiltersOperations", "NetworkSecurityPerimeterConfigurationsOperations", "DefenderForAISettingsOperations", + "ProjectsOperations", + "AccountConnectionsOperations", + "ProjectConnectionsOperations", + "AccountCapabilityHostsOperations", + "ProjectCapabilityHostsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__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/operations/_account_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_capability_hosts_operations.py new file mode 100644 index 000000000000..f3faac879134 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_capability_hosts_operations.py @@ -0,0 +1,591 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + 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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + 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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _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_create_or_update_request( + 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", "2025-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/capabilityHosts/{capabilityHostName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _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) + + +class AccountCapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`account_capability_hosts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + 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 _delete_initial( + self, resource_group_name: str, account_name: str, capability_host_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, capability_host_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete account capabilityHost. + + Delete account 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 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 either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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, + capability_host_name=capability_host_name, + api_version=api_version, + 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 + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **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 get( + self, resource_group_name: str, account_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """Get account capabilityHost. + + Get account 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 capability_host_name: The name of the capability host associated with the Cognitive + Services Resource. Required. + :type capability_host_name: str + :return: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + + 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, + capability_host_name: str, + capability_host: Union[_models.CapabilityHost, 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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" + _json = None + _content = None + if isinstance(capability_host, (IOBase, bytes)): + _content = capability_host + else: + _json = self._serialize.body(capability_host, "CapabilityHost") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + capability_host_name=capability_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, + capability_host_name: str, + capability_host: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account 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 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.CapabilityHost + :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 either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + capability_host: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account 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 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: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + capability_host_name: str, + capability_host: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """Create or update account capabilityHost. + + Create or update account 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 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 either a CapabilityHost type or a + IO[bytes] type. Required. + :type capability_host: ~azure.mgmt.cognitiveservices.models.CapabilityHost or IO[bytes] + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapabilityHost] = 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, + capability_host_name=capability_host_name, + capability_host=capability_host, + api_version=api_version, + 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): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_connections_operations.py new file mode 100644 index 000000000000..2967e529275c --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_account_connections_operations.py @@ -0,0 +1,795 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _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_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", "2025-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_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", "2025-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections/{connectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _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_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/connections", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if target is not None: + _params["target"] = _SERIALIZER.query("target", target, "str") + if category is not None: + _params["category"] = _SERIALIZER.query("category", category, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class AccountConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`account_connections` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + 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 delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, account_name: str, connection_name: str, **kwargs: Any + ) -> None: + """Delete Cognitive Services account connection by name. + + Delete Cognitive Services account 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 connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: None or the result of cls(response) + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def get( + self, resource_group_name: str, account_name: str, connection_name: str, **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Lists Cognitive Services account connection by name. + + Lists Cognitive Services account 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 connection_name: Friendly name of the connection. Required. + :type connection_name: str + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[_models.ConnectionUpdateContent] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified 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 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified 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 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionUpdateContent, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Update Cognitive Services account connection under the specified account. + + Update Cognitive Services account connection under the specified 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 connection_name: Friendly name of the connection. Required. + :type connection_name: str + :param connection: Parameters for account connection update. Is either a + ConnectionUpdateContent type or a IO[bytes] type. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = 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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _json = self._serialize.body(connection, "ConnectionUpdateContent") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[_models.ConnectionPropertiesV2BasicResource] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified 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 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified 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 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + resource_group_name: str, + account_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionPropertiesV2BasicResource, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.ConnectionPropertiesV2BasicResource: + """Create or update Cognitive Services account connection under the specified account. + + Create or update Cognitive Services account connection under the specified 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 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 either a + ConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = 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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _json = self._serialize.body(connection, "ConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + connection_name=connection_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, + resource_group_name: str, + account_name: str, + target: Optional[str] = None, + category: Optional[str] = None, + include_all: bool = False, + **kwargs: Any + ) -> Iterable["_models.ConnectionPropertiesV2BasicResource"]: + """Lists all the available Cognitive Services account connections under the specified account. + + Lists all the available Cognitive Services account connections under the specified 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 target: Target of the connection. Default value is None. + :type target: str + :param category: Category of the connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either ConnectionPropertiesV2BasicResource or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResourceArmPaginatedResult] = 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_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + target=target, + category=category, + include_all=include_all, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py index 5233db0f6856..4c143d85f82a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +48,7 @@ def build_create_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -58,7 +56,7 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -88,7 +86,7 @@ def build_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96,7 +94,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -126,14 +124,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -159,14 +157,14 @@ def build_get_request(resource_group_name: str, account_name: str, subscription_ _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -192,14 +190,14 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -222,7 +220,7 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,14 +246,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/listKeys", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -283,7 +281,7 @@ def build_regenerate_key_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -291,7 +289,7 @@ def build_regenerate_key_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/regenerateKey", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -321,14 +319,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -356,14 +354,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/usages", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -393,14 +391,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/models", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -436,15 +434,17 @@ class AccountsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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 _create_initial( self, resource_group_name: str, account_name: str, account: Union[_models.Account, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +629,7 @@ def get_long_running_output(pipeline_response): def _update_initial( self, resource_group_name: str, account_name: str, account: Union[_models.Account, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -809,7 +809,7 @@ def get_long_running_output(pipeline_response): ) def _delete_initial(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -923,7 +923,7 @@ def get(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _mo :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -983,7 +983,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1059,7 +1059,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Account"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1133,7 +1133,7 @@ def list_keys(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1194,7 +1194,7 @@ def regenerate_key( :rtype: ~azure.mgmt.cognitiveservices.models.ApiKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1256,7 +1256,7 @@ def list_skus(self, resource_group_name: str, account_name: str, **kwargs: Any) :rtype: ~azure.mgmt.cognitiveservices.models.AccountSkuListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1318,7 +1318,7 @@ def list_usages( :rtype: ~azure.mgmt.cognitiveservices.models.UsageListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1383,7 +1383,7 @@ def list_models( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountModelListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py index 411c651e4fed..0f7c75ce2f0a 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_cognitive_services_management_client_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, List, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, List, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,13 +25,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer -from .._vendor import CognitiveServicesManagementClientMixinABC +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Serializer +from .._utils.utils import ClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +40,7 @@ def build_check_sku_availability_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -50,7 +48,7 @@ def build_check_sku_availability_request(location: str, subscription_id: str, ** _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), @@ -73,14 +71,14 @@ def build_check_domain_availability_request(subscription_id: str, **kwargs: Any) _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -102,14 +100,14 @@ def build_calculate_model_capacity_request(subscription_id: str, **kwargs: Any) _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/calculateModelCapacity" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -128,7 +126,7 @@ def build_calculate_model_capacity_request(subscription_id: str, **kwargs: Any) class CognitiveServicesManagementClientOperationsMixin( # pylint: disable=name-too-long - CognitiveServicesManagementClientMixinABC + ClientMixinABC[PipelineClient, CognitiveServicesManagementClientConfiguration] ): @distributed_trace @@ -149,7 +147,7 @@ def check_sku_availability( :rtype: ~azure.mgmt.cognitiveservices.models.SkuAvailabilityListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +211,7 @@ def check_domain_availability( :rtype: ~azure.mgmt.cognitiveservices.models.DomainAvailability :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -280,7 +278,7 @@ def calculate_model_capacity( :rtype: ~azure.mgmt.cognitiveservices.models.CalculateModelCapacityResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py index 1ad7dc62c8aa..5ee35fb3fe21 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_plans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,14 +46,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -83,14 +81,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -119,7 +117,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -127,7 +125,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -158,14 +156,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/commitmentPlans/{commitmentPlanName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -194,7 +192,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -202,7 +200,7 @@ def build_create_or_update_plan_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -232,7 +230,7 @@ def build_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -240,7 +238,7 @@ def build_update_plan_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -270,14 +268,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -305,14 +303,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -340,14 +338,14 @@ def build_list_plans_by_resource_group_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -370,13 +368,13 @@ def build_list_plans_by_subscription_request(subscription_id: str, **kwargs: Any _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/commitmentPlans" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -398,14 +396,14 @@ def build_list_associations_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -437,14 +435,14 @@ def build_get_association_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -482,7 +480,7 @@ def build_create_or_update_association_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -490,7 +488,7 @@ def build_create_or_update_association_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -530,14 +528,14 @@ def build_delete_association_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/commitmentPlans/{commitmentPlanName}/accountAssociations/{commitmentPlanAssociationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -579,10 +577,12 @@ class CommitmentPlansOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable["_models.CommitmentPlan"]: @@ -603,7 +603,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -684,7 +684,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -816,7 +816,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -875,7 +875,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, account_name: str, commitment_plan_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -990,7 +990,7 @@ def _create_or_update_plan_initial( commitment_plan: Union[_models.CommitmentPlan, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1188,7 +1188,7 @@ def _update_plan_initial( commitment_plan: Union[_models.PatchResourceTagsAndSku, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1387,7 +1387,7 @@ def get_long_running_output(pipeline_response): def _delete_plan_initial( self, resource_group_name: str, commitment_plan_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1509,7 +1509,7 @@ def get_plan(self, resource_group_name: str, commitment_plan_name: str, **kwargs :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1571,7 +1571,7 @@ def list_plans_by_resource_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1647,7 +1647,7 @@ def list_plans_by_subscription(self, **kwargs: Any) -> Iterable["_models.Commitm api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1732,7 +1732,7 @@ def list_associations( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentPlanAccountAssociationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1814,7 +1814,7 @@ def get_association( :rtype: ~azure.mgmt.cognitiveservices.models.CommitmentPlanAccountAssociation :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1866,7 +1866,7 @@ def _create_or_update_association_initial( association: Union[_models.CommitmentPlanAccountAssociation, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2078,7 +2078,7 @@ def get_long_running_output(pipeline_response): 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py index 250ff3bb6a0a..7761d3484b00 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_commitment_tiers_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,14 +40,14 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/commitmentTiers", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), @@ -81,10 +78,12 @@ class CommitmentTiersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, location: str, **kwargs: Any) -> Iterable["_models.CommitmentTier"]: @@ -102,7 +101,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.CommitmentTier api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommitmentTierListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_defender_for_ai_settings_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_defender_for_ai_settings_operations.py index e70dbebd2b8f..2f1041020b59 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_defender_for_ai_settings_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_defender_for_ai_settings_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -44,14 +42,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -79,14 +77,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -117,7 +115,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -125,7 +123,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -158,7 +156,7 @@ def build_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,7 +164,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/defenderForAISettings/{defenderForAISettingName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -207,10 +205,12 @@ class DefenderForAISettingsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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( @@ -234,7 +234,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DefenderForAISettingResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -314,7 +314,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -444,7 +444,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -586,7 +586,7 @@ def update( :rtype: ~azure.mgmt.cognitiveservices.models.DefenderForAISetting :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py index 8537120f87da..b3b2031d331b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deleted_accounts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +31,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,14 +47,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "resourceGroupName": _SERIALIZER.url( @@ -85,14 +83,14 @@ def build_purge_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/resourceGroups/{resourceGroupName}/deletedAccounts/{accountName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "location": _SERIALIZER.url("location", location, "str"), "resourceGroupName": _SERIALIZER.url( @@ -119,13 +117,13 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/deletedAccounts" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -155,10 +153,12 @@ class DeletedAccountsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.Account: @@ -175,7 +175,7 @@ def get(self, location: str, resource_group_name: str, account_name: str, **kwar :rtype: ~azure.mgmt.cognitiveservices.models.Account :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +222,7 @@ def get(self, location: str, resource_group_name: str, account_name: str, **kwar def _purge_initial( self, location: str, resource_group_name: str, account_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -341,7 +341,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Account"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AccountListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py index d9f8d0f197d6..29220049b3e2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_deployments_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,14 +46,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -83,14 +81,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -119,7 +117,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -127,7 +125,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -158,7 +156,7 @@ def build_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -166,7 +164,7 @@ def build_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -197,14 +195,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -233,14 +231,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/deployments/{deploymentName}/skus", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -277,10 +275,12 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable["_models.Deployment"]: @@ -301,7 +301,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -382,7 +382,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.Deployment :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,7 +434,7 @@ def _create_or_update_initial( deployment: Union[_models.Deployment, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -641,7 +641,7 @@ def _update_initial( deployment: Union[_models.PatchResourceTagsAndSku, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -847,7 +847,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, resource_group_name: str, account_name: str, deployment_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -979,7 +979,7 @@ def list_skus( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DeploymentSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py index b9070fe47ada..9e89a9e70217 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_encryption_scopes_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,14 +46,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -83,14 +81,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -121,7 +119,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +127,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -162,14 +160,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/encryptionScopes/{encryptionScopeName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -208,10 +206,12 @@ class EncryptionScopesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable["_models.EncryptionScope"]: @@ -232,7 +232,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.EncryptionScopeListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +313,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +445,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.EncryptionScope :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +504,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, account_name: str, encryption_scope_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_location_based_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_location_based_model_capacities_operations.py index a15bd5a3df0c..89361dbe65fb 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_location_based_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_location_based_model_capacities_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,14 +42,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/modelCapacities", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), @@ -90,10 +87,12 @@ class LocationBasedModelCapacitiesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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( @@ -121,7 +120,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelCapacityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_model_capacities_operations.py index 08c80d5efe48..88671329a928 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_model_capacities_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,13 +42,13 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/modelCapacities" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -88,10 +85,12 @@ class ModelCapacitiesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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( @@ -117,7 +116,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelCapacityListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py index ba67f2b389cf..03c5d2c79833 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_models_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,14 +40,14 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/models", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), @@ -81,10 +78,12 @@ class ModelsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, location: str, **kwargs: Any) -> Iterable["_models.Model"]: @@ -102,7 +101,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.Model"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ModelListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_network_security_perimeter_configurations_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_network_security_perimeter_configurations_operations.py index f7b825b1d952..ed04ca194390 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_network_security_perimeter_configurations_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_network_security_perimeter_configurations_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Iterator, Optional, Type, TypeVar, Union, cast +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Iterator, Optional, TypeVar, Union, cast import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -30,12 +31,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,14 +45,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -82,14 +80,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -120,14 +118,14 @@ def build_reconcile_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/networkSecurityPerimeterConfigurations/{nspConfigurationName}/reconcile", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -166,10 +164,12 @@ class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name- def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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( @@ -194,7 +194,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.NetworkSecurityPerimeterConfigurationList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -274,7 +274,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.NetworkSecurityPerimeterConfiguration :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +321,7 @@ def get( def _reconcile_initial( self, resource_group_name: str, account_name: str, nsp_configuration_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 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 498d2fae7a7d..1e5cd4d10ac8 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,7 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,10 +69,12 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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) -> Iterable["_models.Operation"]: @@ -91,7 +90,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py index d61ee9109250..f669a06d0af3 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -29,12 +30,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,14 +44,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -85,14 +83,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -127,7 +125,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +133,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -172,14 +170,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -218,10 +216,12 @@ class PrivateEndpointConnectionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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( @@ -238,7 +238,7 @@ def list( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnectionListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +299,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +351,7 @@ def _create_or_update_initial( properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -560,7 +560,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, resource_group_name: str, account_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py index 3ee1d266a568..2e9a3e7df4b0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,12 +25,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,14 +39,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/privateLinkResources", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -84,10 +82,12 @@ class PrivateLinkResourcesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, resource_group_name: str, account_name: str, **kwargs: Any) -> _models.PrivateLinkResourceListResult: @@ -102,7 +102,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> _m :rtype: ~azure.mgmt.cognitiveservices.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_capability_hosts_operations.py new file mode 100644 index 000000000000..c9af252aeca6 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_capability_hosts_operations.py @@ -0,0 +1,634 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, + account_name: str, + project_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + account_name: str, + project_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _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_create_or_update_request( + resource_group_name: str, + account_name: str, + project_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", "2025-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/capabilityHosts/{capabilityHostName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "capabilityHostName": _SERIALIZER.url( + "capability_host_name", capability_host_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,254}$" + ), + } + + _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) + + +class ProjectCapabilityHostsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`project_capability_hosts` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + 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 _delete_initial( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, project_name: str, capability_host_name: str, **kwargs: Any + ) -> LROPoller[None]: + """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 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 either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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, + capability_host_name=capability_host_name, + api_version=api_version, + 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 + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **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 get( + self, resource_group_name: str, account_name: str, project_name: str, capability_host_name: str, **kwargs: Any + ) -> _models.CapabilityHost: + """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 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: CapabilityHost or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.CapabilityHost + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.CapabilityHost] = kwargs.pop("cls", None) + + _request = build_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + + 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.CapabilityHost, 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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" + _json = None + _content = None + if isinstance(capability_host, (IOBase, bytes)): + _content = capability_host + else: + _json = self._serialize.body(capability_host, "CapabilityHost") + + _request = build_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, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["x-ms-async-operation-timeout"] = self._deserialize( + "duration", response.headers.get("x-ms-async-operation-timeout") + ) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + 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, + project_name: str, + capability_host_name: str, + capability_host: _models.CapabilityHost, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """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 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.CapabilityHost + :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 either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + capability_host: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """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 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: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + capability_host_name: str, + capability_host: Union[_models.CapabilityHost, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CapabilityHost]: + """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 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 either a CapabilityHost type or a + IO[bytes] type. Required. + :type capability_host: ~azure.mgmt.cognitiveservices.models.CapabilityHost or IO[bytes] + :return: An instance of LROPoller that returns either CapabilityHost or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.CapabilityHost] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CapabilityHost] = 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, + api_version=api_version, + 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): + deserialized = self._deserialize("CapabilityHost", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CapabilityHost].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CapabilityHost]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_connections_operations.py new file mode 100644 index 000000000000..8e9cfdee0d76 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_project_connections_operations.py @@ -0,0 +1,861 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_delete_request( + resource_group_name: str, + account_name: str, + project_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + account_name: str, + project_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _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_update_request( + resource_group_name: str, + account_name: str, + project_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", "2025-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_request( + resource_group_name: str, + account_name: str, + project_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", "2025-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections/{connectionName}", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "connectionName": _SERIALIZER.url( + "connection_name", connection_name, "str", pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_-]{2,32}$" + ), + } + + _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_list_request( + resource_group_name: str, + account_name: str, + project_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}/connections", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if target is not None: + _params["target"] = _SERIALIZER.query("target", target, "str") + if category is not None: + _params["category"] = _SERIALIZER.query("category", category, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "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") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +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. + """ + + models = _models + + def __init__(self, *args, **kwargs): + 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 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 or the result of cls(response) + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_delete_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @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 or the result of cls(response) + :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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + _request = build_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + 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. + + :param resource_group_name: The name of the resource group. The 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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. + + 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: 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 or the result of cls(response) + :rtype: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + connection_name: str, + connection: Optional[Union[_models.ConnectionUpdateContent, IO[bytes]]] = None, + **kwargs: Any + ) -> _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 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 either a + ConnectionUpdateContent type or a IO[bytes] type. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionUpdateContent or IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = 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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _json = self._serialize.body(connection, "ConnectionUpdateContent") + else: + _json = None + + _request = build_update_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=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + 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 or the result of cls(response) + :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 or the result of cls(response) + :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, 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 either a + ConnectionPropertiesV2BasicResource type or a IO[bytes] type. Default value is None. + :type connection: ~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource or + IO[bytes] + :return: ConnectionPropertiesV2BasicResource or the result of cls(response) + :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 = 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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(connection, (IOBase, bytes)): + _content = connection + else: + if connection is not None: + _json = self._serialize.body(connection, "ConnectionPropertiesV2BasicResource") + else: + _json = None + + _request = build_create_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=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ConnectionPropertiesV2BasicResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + 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 + ) -> Iterable["_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. + + :param resource_group_name: The name of the resource group. The 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 target: Target of the connection. Default value is None. + :type target: str + :param category: Category of the connection. Default value is None. + :type category: str + :param include_all: query parameter that indicates if get connection call should return both + connections and datastores. Default value is False. + :type include_all: bool + :return: An iterator like instance of either ConnectionPropertiesV2BasicResource or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.ConnectionPropertiesV2BasicResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ConnectionPropertiesV2BasicResourceArmPaginatedResult] = 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_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=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ConnectionPropertiesV2BasicResourceArmPaginatedResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_projects_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_projects_operations.py new file mode 100644 index 000000000000..9a5cd437165f --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_projects_operations.py @@ -0,0 +1,913 @@ +# 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) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_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", "2025-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_update_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", "2025-06-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects/{projectName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "projectName": _SERIALIZER.url( + "project_name", project_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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_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", "2025-06-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/projects", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "accountName": _SERIALIZER.url( + "account_name", account_name, "str", max_length=64, min_length=2, pattern=r"^[a-zA-Z0-9][a-zA-Z0-9_.-]*$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + } + + _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) + + +class ProjectsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.cognitiveservices.CognitiveServicesManagementClient`'s + :attr:`projects` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + 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 _create_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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" + _json = None + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _json = self._serialize.body(project, "Project") + + _request = build_create_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: _models.Project, + *, + 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. + + :param resource_group_name: The name of the resource group. The 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 + :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 either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: 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. + + :param resource_group_name: The name of the resource group. The 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] + :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 either Project or the result of cls(response) + :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, 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 either a Project type or + a IO[bytes] type. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or IO[bytes] + :return: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", 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, + api_version=api_version, + 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): + deserialized = self._deserialize("Project", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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 + ) + + def _update_initial( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, 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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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" + _json = None + _content = None + if isinstance(project, (IOBase, bytes)): + _content = project + else: + _json = self._serialize.body(project, "Project") + + _request = build_update_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: _models.Project, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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 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: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> 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 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 either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + account_name: str, + project_name: str, + project: Union[_models.Project, IO[bytes]], + **kwargs: Any + ) -> 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 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 either a Project type or + a IO[bytes] type. Required. + :type project: ~azure.mgmt.cognitiveservices.models.Project or IO[bytes] + :return: An instance of LROPoller that returns either Project or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _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", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", 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, + api_version=api_version, + 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): + deserialized = self._deserialize("Project", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + 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 + ) + + def _delete_initial( + self, resource_group_name: str, account_name: str, project_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 = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_delete_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, account_name: str, project_name: str, **kwargs: Any + ) -> LROPoller[None]: + """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 project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + 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, + api_version=api_version, + 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 + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **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 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 project_name: The name of Cognitive Services account's project. Required. + :type project_name: str + :return: Project or the result of cls(response) + :rtype: ~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 = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.Project] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + account_name=account_name, + project_name=project_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("Project", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable["_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 either Project or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.cognitiveservices.models.Project] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ProjectListResult] = 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_list_request( + resource_group_name=resource_group_name, + account_name=account_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + 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 + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProjectListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link 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 = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py index 23b61f3156a0..54d40e0cfb54 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklist_items_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,13 +32,10 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,14 +49,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -94,14 +92,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -140,7 +138,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -148,7 +146,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -189,14 +187,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/raiBlocklistItems/{raiBlocklistItemName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -230,7 +228,7 @@ def build_batch_add_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -238,7 +236,7 @@ def build_batch_add_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/addRaiBlocklistItems", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -277,7 +275,7 @@ def build_batch_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -285,7 +283,7 @@ def build_batch_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}/deleteRaiBlocklistItems", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -326,10 +324,12 @@ class RaiBlocklistItemsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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( @@ -355,7 +355,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiBlockListItemsResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +445,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +590,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklistItem :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -655,7 +655,7 @@ def _delete_initial( rai_blocklist_item_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -869,7 +869,7 @@ def batch_add( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -950,7 +950,7 @@ def batch_delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py index 65f36bc9dbc5..11f7933fd8f2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_blocklists_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,14 +46,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -83,14 +81,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -121,7 +119,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +127,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -162,14 +160,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiBlocklists/{raiBlocklistName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -208,10 +206,12 @@ class RaiBlocklistsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable["_models.RaiBlocklist"]: @@ -232,7 +232,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiBlockListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +313,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +445,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiBlocklist :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +504,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, account_name: str, rai_blocklist_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py index 5b762d57fc27..028e2ad7fc0c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_content_filters_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +27,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,14 +41,14 @@ def build_list_request(location: str, subscription_id: str, **kwargs: Any) -> Ht _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), @@ -71,14 +69,14 @@ def build_get_request(location: str, filter_name: str, subscription_id: str, **k _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/raiContentFilters/{filterName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), @@ -110,10 +108,12 @@ class RaiContentFiltersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, location: str, **kwargs: Any) -> Iterable["_models.RaiContentFilter"]: @@ -131,7 +131,7 @@ def list(self, location: str, **kwargs: Any) -> Iterable["_models.RaiContentFilt api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiContentFilterListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -205,7 +205,7 @@ def get(self, location: str, filter_name: str, **kwargs: Any) -> _models.RaiCont :rtype: ~azure.mgmt.cognitiveservices.models.RaiContentFilter :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py index 30c660614d87..a7de8de7d51f 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_rai_policies_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,14 +46,14 @@ def build_list_request(resource_group_name: str, account_name: str, subscription _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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -83,14 +81,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -121,7 +119,7 @@ def build_create_or_update_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +127,7 @@ def build_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -162,14 +160,14 @@ def build_delete_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.CognitiveServices/accounts/{accountName}/raiPolicies/{raiPolicyName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -208,10 +206,12 @@ class RaiPoliciesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, resource_group_name: str, account_name: str, **kwargs: Any) -> Iterable["_models.RaiPolicy"]: @@ -232,7 +232,7 @@ def list(self, resource_group_name: str, account_name: str, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RaiPolicyListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -313,7 +313,7 @@ def get( :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,7 +445,7 @@ def create_or_update( :rtype: ~azure.mgmt.cognitiveservices.models.RaiPolicy :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -504,7 +504,7 @@ def create_or_update( def _delete_initial( self, resource_group_name: str, account_name: str, rai_policy_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py index 54248937d0f1..b57eecb94225 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_resource_skus_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +40,7 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -77,10 +74,12 @@ class ResourceSkusOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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) -> Iterable["_models.ResourceSku"]: @@ -96,7 +95,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.ResourceSku"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ResourceSkuListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py index 742bbd2ef2cb..e4dfbfb0a7e4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/azure/mgmt/cognitiveservices/operations/_usages_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from collections.abc import MutableMapping +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from .._serialization import Serializer +from .._configuration import CognitiveServicesManagementClientConfiguration +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,14 +42,14 @@ def build_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", "2024-10-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-06-01")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/usages", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "location": _SERIALIZER.url("location", location, "str"), @@ -85,10 +82,12 @@ class UsagesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + 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, location: str, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Usage"]: @@ -110,7 +109,7 @@ def list(self, location: str, filter: Optional[str] = None, **kwargs: Any) -> It api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UsageListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/create_or_update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/create_or_update.py new file mode 100644 index 000000000000..2fd293eda9db --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/create_or_update.py @@ -0,0 +1,49 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_capability_hosts.begin_create_or_update( + resource_group_name="test-rg", + account_name="account-1", + capability_host_name="capabilityHostName", + capability_host={ + "properties": { + "customerSubnet": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroups/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet" + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/AccountCapabilityHost/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/delete.py new file mode 100644 index 000000000000..1ed983caf8ef --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/delete.py @@ -0,0 +1,43 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + client.account_capability_hosts.begin_delete( + resource_group_name="test-rg", + account_name="account-1", + capability_host_name="capabilityHostName", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/AccountCapabilityHost/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/get.py new file mode 100644 index 000000000000..45bf50447425 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_capability_host/get.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_capability_hosts.get( + resource_group_name="test-rg", + account_name="account-1", + capability_host_name="capabilityHostName", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/AccountCapabilityHost/get.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/create.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/create.py new file mode 100644 index 000000000000..e501e09a7fd2 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/create.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_connections.create( + resource_group_name="resourceGroup-1", + account_name="account-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/AccountConnection/create.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/delete.py new file mode 100644 index 000000000000..0f30bdaab188 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/delete.py @@ -0,0 +1,43 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + client.account_connections.delete( + resource_group_name="resourceGroup-1", + account_name="account-1", + connection_name="connection-1", + ) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/AccountConnection/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/get.py new file mode 100644 index 000000000000..f39db90d2cae --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/get.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_connections.get( + resource_group_name="resourceGroup-1", + account_name="account-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/AccountConnection/get.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/list.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/list.py new file mode 100644 index 000000000000..4f907722a11a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/list.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_connections.list( + resource_group_name="resourceGroup-1", + account_name="account-1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/AccountConnection/list.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/update.py new file mode 100644 index 000000000000..0aaec66924bf --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/account_connection/update.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.account_connections.update( + resource_group_name="test-rg", + account_name="account-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/AccountConnection/update.json +if __name__ == "__main__": + main() 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 6c104e916adf..efe5fc143857 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -42,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/AddRaiBlocklistItems.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 8347b83e5028..1ffb3e834bf0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,13 +28,13 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.calculate_model_capacity() print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CalculateModelCapacity.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CalculateModelCapacity.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 2a1c559e7847..a17c41df34d0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.begin_create( @@ -48,7 +49,7 @@ def main(): }, "userOwnedStorage": [ { - "resourceId": "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount" + "resourceId": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount" } ], }, @@ -58,6 +59,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CreateAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 f2d26bd1dc40..9c4f52b7100b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.begin_create( @@ -44,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CreateAccountMin.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateAccountMin.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 new file mode 100644 index 000000000000..40adf29a3b1b --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project.py @@ -0,0 +1,49 @@ +# 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) AutoRest 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_project.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.begin_create( + resource_group_name="myResourceGroup", + account_name="testCreate1", + project_name="testProject1", + project={ + "identity": {"type": "SystemAssigned"}, + "location": "West US", + "properties": {"description": "Description of this project", "displayName": "p1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 new file mode 100644 index 000000000000..90386e97c2f8 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/create_project_min.py @@ -0,0 +1,45 @@ +# 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) AutoRest 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_project_min.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.begin_create( + resource_group_name="myResourceGroup", + account_name="testCreate1", + project_name="testProject1", + project={"identity": {"type": "SystemAssigned"}, "location": "West US", "properties": {}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 04d2dd4e75ef..6c486e98c55b 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.begin_create_or_update_plan( @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CreateSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 d11ac9afe703..8309e49033b9 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.begin_create_or_update_association( @@ -43,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/CreateSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/CreateSharedCommitmentPlanAssociation.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 2d16752e4c32..a2e14ff8ccb8 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.accounts.begin_delete( @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 19d717a8217f..077923a20ee0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.commitment_plans.begin_delete( @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/DeleteCommitmentPlan.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 65f919209721..01cc82971de4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_deployment.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.deployments.begin_delete( @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 192358b28d9d..83e3807065a5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteEncryptionScope.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/DeleteEncryptionScope.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 8bea51f398d5..cbe99f60d3b2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.private_endpoint_connections.begin_delete( @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 new file mode 100644 index 000000000000..4c338231cbee --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/delete_project.py @@ -0,0 +1,43 @@ +# 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) AutoRest 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_project.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="00000000-1111-2222-3333-444444444444", + ) + + client.projects.begin_delete( + resource_group_name="myResourceGroup", + account_name="PropTest01", + project_name="myProject", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 6a5892bcf431..bea57fa1afcf 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklist.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 c14a28aab878..25d8501a34cf 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklistItem.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 0d1028f5aa1d..75ffc8393c89 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): ) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiBlocklistItems.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/DeleteRaiBlocklistItems.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 e266c03dc601..c4914911a853 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteRaiPolicy.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/DeleteRaiPolicy.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 1791873f304a..3a8e61f45b89 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.commitment_plans.begin_delete_plan( @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 c9a67163869d..5234eb207495 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.commitment_plans.begin_delete_association( @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/DeleteSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/DeleteSharedCommitmentPlanAssociation.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 1881b8c46079..d39b6294cd69 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 3598174a6875..977e1dc512cf 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.get( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/GetCommitmentPlan.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 35a84b8457e9..49a0ed029825 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDefenderForAISetting.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 40dda72c3f7c..fc92cd037165 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deleted_accounts.get( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDeletedAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 a3a4d524f0e0..45031939d773 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_deployment.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deployments.get( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 ba5cbf44a55f..393957531ee6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetEncryptionScope.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/GetEncryptionScope.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 ae44c6e143d7..740680e764d8 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 38776f9f83b7..bd9c13a838fc 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetOperations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 56da5166c4c4..a299d99620f9 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.private_endpoint_connections.get( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 new file mode 100644 index 000000000000..27d31cc2be3f --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_project.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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_project.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.get( + resource_group_name="myResourceGroup", + account_name="myAccount", + project_name="myProject", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/GetProject.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 2d5a3213df05..67cde078a41d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiBlocklist.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 e951859c73b3..0a08d713f75e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiBlocklistItem.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 e1d7147b2306..e2670a6b304f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiContentFilter.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/GetRaiContentFilter.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 8e883ce4f930..cdb65b49684e 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetRaiPolicy.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/GetRaiPolicy.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 1a6c21d1cf62..37bb71ac78c0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.get_plan( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 69c381e8f0a7..75bacd2b6d3a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.get_association( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetSharedCommitmentPlanAssociation.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 786ea31485ab..355476a732f4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_skus.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetSkus.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/GetSkus.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 88803a4c6b24..74352e9baa51 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/get_usages.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/GetUsages.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/GetUsages.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 aa9af113805c..b3c5ee693954 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list_models( @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListAccountModels.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 9d5062752922..5cff6bab6990 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list_by_resource_group( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListAccountsByResourceGroup.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 7bcf5a77e871..bcdb35525305 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListAccountsBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListAccountsBySubscription.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 016217162532..7e1d0d7e80a2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListBlocklistItems.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 a37dbdc54020..e0d4e01abd01 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_blocklists.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListBlocklists.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 30cf8daaf9fb..7171ef7da7d1 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.list( @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListCommitmentPlans.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 12d2fbde7bb1..2c23b3419c16 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_tiers.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListCommitmentTiers.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListCommitmentTiers.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 a7bea7f61470..31103c8e35d9 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDefenderForAISetting.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 78a21f185710..d81c751246e2 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deleted_accounts.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDeletedAccountsBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 00f91265d17c..6923f478a9b5 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDeploymentSkus.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 e151c56a572c..dcf4215d4259 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deployments.list( @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListDeployments.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 55765b0380b2..9df6cd6bc77c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListEncryptionScopes.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 26c026caa943..bc14d1798c66 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_keys.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list_keys( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListKeys.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 1ac614c9d699..28bb0ac0fb06 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,6 +41,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListLocationBasedModelCapacities.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListLocationBasedModelCapacities.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 b584ac9a6ca9..6bb39b46a5ca 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListLocationModels.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListLocationModels.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 947290881e47..afc70b5bcf77 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListModelCapacities.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListModelCapacities.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 f0c188ba01be..f490c25999ac 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 f4eab22e979f..70454a99003c 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.private_endpoint_connections.list( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListPrivateEndpointConnections.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 f7f386bd2ce6..72d63a54aedf 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.private_link_resources.list( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListPrivateLinkResources.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 new file mode 100644 index 000000000000..7a75f11f4354 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_projects.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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_projects.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.list( + resource_group_name="myResourceGroup", + account_name="myAccount", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListProjects.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 dee5fd639f8d..82be052cf20f 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListRaiContentFilters.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListRaiContentFilters.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 86dffa7fb150..9b8b5f5193e6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListRaiPolicies.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListRaiPolicies.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 e15d1716d255..ff88e03c8d30 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.list_associations( @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListSharedCommitmentPlanAssociations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 59c13a21ed0f..f07f773d78ca 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.list_plans_by_resource_group( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListSharedCommitmentPlansByResourceGroup.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 0e15ba4a3c4f..3678c1836dd0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.list_plans_by_subscription() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListSharedCommitmentPlansBySubscription.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 6cafafb8b3e3..c7b4aaa305a0 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_skus.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.list_skus( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListSkus.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 3a488eb0a34a..1e1e00300aec 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_usages.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ListUsages.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ListUsages.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/create_or_update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/create_or_update.py new file mode 100644 index 000000000000..02ae36e0ea22 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/create_or_update.py @@ -0,0 +1,50 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_capability_hosts.begin_create_or_update( + resource_group_name="test-rg", + account_name="account-1", + project_name="project-1", + capability_host_name="capabilityHostName", + capability_host={ + "properties": { + "customerSubnet": "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/myResourceGroups/providers/Microsoft.Network/virtualNetworks/myVnet/subnets/mySubnet" + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ProjectCapabilityHost/createOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/delete.py new file mode 100644 index 000000000000..022258d9a397 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/delete.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + client.project_capability_hosts.begin_delete( + resource_group_name="test-rg", + account_name="account-1", + project_name="project-1", + capability_host_name="capabilityHostName", + ).result() + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ProjectCapabilityHost/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/get.py new file mode 100644 index 000000000000..f9dedcb0d3ef --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_capability_host/get.py @@ -0,0 +1,45 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_capability_hosts.get( + resource_group_name="test-rg", + account_name="account-1", + project_name="project-1", + capability_host_name="capabilityHostName", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ProjectCapabilityHost/get.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/create.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/create.py new file mode 100644 index 000000000000..37d393a86524 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/create.py @@ -0,0 +1,45 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_connections.create( + resource_group_name="resourceGroup-1", + account_name="account-1", + project_name="project-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ProjectConnection/create.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/delete.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/delete.py new file mode 100644 index 000000000000..11bfddc32e74 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/delete.py @@ -0,0 +1,44 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + client.project_connections.delete( + resource_group_name="resourceGroup-1", + account_name="account-1", + project_name="project-1", + connection_name="connection-1", + ) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ProjectConnection/delete.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/get.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/get.py new file mode 100644 index 000000000000..668d99854d8a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/get.py @@ -0,0 +1,45 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_connections.get( + resource_group_name="resourceGroup-1", + account_name="account-1", + project_name="project-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ProjectConnection/get.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/list.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/list.py new file mode 100644 index 000000000000..b60a2981f2c8 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/list.py @@ -0,0 +1,45 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_connections.list( + resource_group_name="resourceGroup-1", + account_name="account-1", + project_name="project-1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ProjectConnection/list.json +if __name__ == "__main__": + main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/update.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/update.py new file mode 100644 index 000000000000..2923178e05a5 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/project_connection/update.py @@ -0,0 +1,45 @@ +# 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) AutoRest 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.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.project_connections.update( + resource_group_name="test-rg", + account_name="account-1", + project_name="project-1", + connection_name="connection-1", + ) + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ProjectConnection/update.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 3c4c92848dbd..cc47723746d0 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) client.deleted_accounts.begin_purge( @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PurgeDeletedAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 05f98b64c533..18c02c6e7058 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.create_or_update( @@ -46,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/PutCommitmentPlan.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 a67329990383..830cb9fe7dba 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/put_deployment.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="subscriptionId", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.deployments.begin_create_or_update( @@ -42,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 cc44609256b0..573cb18fed73 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -50,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutEncryptionScope.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 efb30439e8c9..de03c998e58d 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.private_endpoint_connections.begin_create_or_update( @@ -41,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutPrivateEndpointConnection.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 108a5e7d6956..2a56dbd708cc 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiBlocklist.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/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 f2f5d3fb7139..bb510a25d0a6 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiBlocklistItem.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/PutRaiBlocklistItem.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 683d5e7b1b86..d7a86993956a 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -106,6 +107,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/PutRaiPolicy.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/PutRaiPolicy.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 67b0298f793e..b053a1a5f5f3 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/ReconcileNetworkSecurityPerimeterConfigurations.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/ReconcileNetworkSecurityPerimeterConfigurations.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 48dfb3319564..5d5d1d17b6ad 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.accounts.begin_update( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateAccount.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/UpdateAccount.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 2dd9f32d9d19..c9335568be28 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_deployment.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -39,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateDeployment.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/UpdateDeployment.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 new file mode 100644 index 000000000000..0a18487536b7 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/update_projects.py @@ -0,0 +1,45 @@ +# 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) AutoRest 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_projects.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="00000000-1111-2222-3333-444444444444", + ) + + response = client.projects.begin_update( + resource_group_name="bvttest", + account_name="bingSearch", + project_name="projectName", + project={"location": "global", "properties": {"description": "new description."}}, + ).result() + print(response) + + +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/UpdateProjects.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 51b582128e7b..d6c64f6b9c72 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 @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = CognitiveServicesManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="00000000-1111-2222-3333-444444444444", ) response = client.commitment_plans.begin_update_plan( @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2024-10-01/examples/UpdateSharedCommitmentPlan.json +# x-ms-original-file: specification/cognitiveservices/resource-manager/Microsoft.CognitiveServices/stable/2025-06-01/examples/UpdateSharedCommitmentPlan.json if __name__ == "__main__": main() diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/conftest.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/conftest.py index de62be014178..14a373f0b945 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/conftest.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): cognitiveservicesmanagement_subscription_id = os.environ.get( diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management.py index c22944f9a79a..ef7e4ffe9ac6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management.py @@ -26,7 +26,7 @@ def test_check_sku_availability(self, resource_group): skus=["str"], kind="str", type="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_check_domain_availability(self, resource_group): response = self.client.check_domain_availability( subdomain_name="str", type="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -48,7 +48,7 @@ def test_check_domain_availability(self, resource_group): @recorded_by_proxy def test_calculate_model_capacity(self, resource_group): response = self.client.calculate_model_capacity( - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations.py new file mode 100644 index 000000000000..d8c5671cc15a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations.py @@ -0,0 +1,74 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementAccountCapabilityHostsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_capability_hosts_begin_delete(self, resource_group): + response = self.client.account_capability_hosts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + api_version="2025-06-01", + ).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_account_capability_hosts_get(self, resource_group): + response = self.client.account_capability_hosts.get( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_capability_hosts_begin_create_or_update(self, resource_group): + response = self.client.account_capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + capability_host={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "threadStorageConnections": ["str"], + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2025-06-01", + ).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_account_capability_hosts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations_async.py new file mode 100644 index 000000000000..ab21a4e940ad --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_capability_hosts_operations_async.py @@ -0,0 +1,79 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementAccountCapabilityHostsOperationsAsync(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_account_capability_hosts_begin_delete(self, resource_group): + response = await ( + await self.client.account_capability_hosts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + api_version="2025-06-01", + ) + ).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_account_capability_hosts_get(self, resource_group): + response = await self.client.account_capability_hosts.get( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_capability_hosts_begin_create_or_update(self, resource_group): + response = await ( + await self.client.account_capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + capability_host_name="str", + capability_host={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "threadStorageConnections": ["str"], + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2025-06-01", + ) + ).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_account_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connections_operations.py new file mode 100644 index 000000000000..c9a0a586468a --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connections_operations.py @@ -0,0 +1,83 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementAccountConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connections_delete(self, resource_group): + response = self.client.account_connections.delete( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connections_get(self, resource_group): + response = self.client.account_connections.get( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connections_update(self, resource_group): + response = self.client.account_connections.update( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connections_create(self, resource_group): + response = self.client.account_connections.create( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_account_connections_list(self, resource_group): + response = self.client.account_connections.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2025-06-01", + ) + 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_account_connections_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connections_operations_async.py new file mode 100644 index 000000000000..ecb597f36c61 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_account_connections_operations_async.py @@ -0,0 +1,84 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementAccountConnectionsOperationsAsync(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_account_connections_delete(self, resource_group): + response = await self.client.account_connections.delete( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connections_get(self, resource_group): + response = await self.client.account_connections.get( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connections_update(self, resource_group): + response = await self.client.account_connections.update( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connections_create(self, resource_group): + response = await self.client.account_connections.create( + resource_group_name=resource_group.name, + account_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_account_connections_list(self, resource_group): + response = self.client.account_connections.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2025-06-01", + ) + 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_accounts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations.py index 167545e80b77..fecd891d8582 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 @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create(self, resource_group): + def test_accounts_begin_create(self, resource_group): response = self.client.accounts.begin_create( resource_group_name=resource_group.name, account_name="str", @@ -38,6 +38,7 @@ def test_begin_create(self, resource_group): "name": "str", "properties": { "abusePenalty": {"action": "str", "expiration": "2020-02-20 00:00:00", "rateLimitPercentage": 0.0}, + "allowProjectManagement": bool, "allowedFqdnList": ["str"], "amlWorkspace": {"identityClientId": "str", "resourceId": "str"}, "apiProperties": { @@ -52,6 +53,7 @@ def test_begin_create(self, resource_group): "superUser": "str", "websiteName": "str", }, + "associatedProjects": ["str"], "callRateLimit": { "count": 0.0, "renewalPeriod": 0.0, @@ -70,6 +72,7 @@ def test_begin_create(self, resource_group): "commitmentPlanAssociations": [{"commitmentPlanId": "str", "commitmentPlanLocation": "str"}], "customSubDomainName": "str", "dateCreated": "str", + "defaultProject": "str", "deletionDate": "str", "disableLocalAuth": bool, "dynamicThrottlingEnabled": bool, @@ -99,6 +102,7 @@ def test_begin_create(self, resource_group): {"id": "str", "ignoreMissingVnetServiceEndpoint": bool, "state": "str"} ], }, + "networkInjections": {"scenario": "str", "subnetArmId": "str", "useMicrosoftManagedNetwork": bool}, "privateEndpointConnections": [ { "etag": "str", @@ -165,7 +169,7 @@ def test_begin_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -173,7 +177,7 @@ def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_accounts_begin_update(self, resource_group): response = self.client.accounts.begin_update( resource_group_name=resource_group.name, account_name="str", @@ -191,6 +195,7 @@ def test_begin_update(self, resource_group): "name": "str", "properties": { "abusePenalty": {"action": "str", "expiration": "2020-02-20 00:00:00", "rateLimitPercentage": 0.0}, + "allowProjectManagement": bool, "allowedFqdnList": ["str"], "amlWorkspace": {"identityClientId": "str", "resourceId": "str"}, "apiProperties": { @@ -205,6 +210,7 @@ def test_begin_update(self, resource_group): "superUser": "str", "websiteName": "str", }, + "associatedProjects": ["str"], "callRateLimit": { "count": 0.0, "renewalPeriod": 0.0, @@ -223,6 +229,7 @@ def test_begin_update(self, resource_group): "commitmentPlanAssociations": [{"commitmentPlanId": "str", "commitmentPlanLocation": "str"}], "customSubDomainName": "str", "dateCreated": "str", + "defaultProject": "str", "deletionDate": "str", "disableLocalAuth": bool, "dynamicThrottlingEnabled": bool, @@ -252,6 +259,7 @@ def test_begin_update(self, resource_group): {"id": "str", "ignoreMissingVnetServiceEndpoint": bool, "state": "str"} ], }, + "networkInjections": {"scenario": "str", "subnetArmId": "str", "useMicrosoftManagedNetwork": bool}, "privateEndpointConnections": [ { "etag": "str", @@ -318,7 +326,7 @@ def test_begin_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -326,11 +334,11 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_accounts_begin_delete(self, resource_group): response = self.client.accounts.begin_delete( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -338,11 +346,11 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_accounts_get(self, resource_group): response = self.client.accounts.get( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -350,10 +358,10 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_accounts_list_by_resource_group(self, resource_group): response = self.client.accounts.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -361,9 +369,9 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_accounts_list(self, resource_group): response = self.client.accounts.list( - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -371,11 +379,11 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_keys(self, resource_group): + def test_accounts_list_keys(self, resource_group): response = self.client.accounts.list_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -383,12 +391,12 @@ def test_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_regenerate_key(self, resource_group): + def test_accounts_regenerate_key(self, resource_group): response = self.client.accounts.regenerate_key( resource_group_name=resource_group.name, account_name="str", key_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -396,11 +404,11 @@ def test_regenerate_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_skus(self, resource_group): + def test_accounts_list_skus(self, resource_group): response = self.client.accounts.list_skus( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -408,11 +416,11 @@ def test_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_usages(self, resource_group): + def test_accounts_list_usages(self, resource_group): response = self.client.accounts.list_usages( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -420,11 +428,11 @@ def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_models(self, resource_group): + def test_accounts_list_models(self, resource_group): response = self.client.accounts.list_models( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_accounts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_accounts_operations_async.py index 48231dfd55a2..9dc0a22a7855 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 @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create(self, resource_group): + async def test_accounts_begin_create(self, resource_group): response = await ( await self.client.accounts.begin_create( resource_group_name=resource_group.name, @@ -44,6 +44,7 @@ async def test_begin_create(self, resource_group): "expiration": "2020-02-20 00:00:00", "rateLimitPercentage": 0.0, }, + "allowProjectManagement": bool, "allowedFqdnList": ["str"], "amlWorkspace": {"identityClientId": "str", "resourceId": "str"}, "apiProperties": { @@ -58,6 +59,7 @@ async def test_begin_create(self, resource_group): "superUser": "str", "websiteName": "str", }, + "associatedProjects": ["str"], "callRateLimit": { "count": 0.0, "renewalPeriod": 0.0, @@ -76,6 +78,7 @@ async def test_begin_create(self, resource_group): "commitmentPlanAssociations": [{"commitmentPlanId": "str", "commitmentPlanLocation": "str"}], "customSubDomainName": "str", "dateCreated": "str", + "defaultProject": "str", "deletionDate": "str", "disableLocalAuth": bool, "dynamicThrottlingEnabled": bool, @@ -105,6 +108,11 @@ async def test_begin_create(self, resource_group): {"id": "str", "ignoreMissingVnetServiceEndpoint": bool, "state": "str"} ], }, + "networkInjections": { + "scenario": "str", + "subnetArmId": "str", + "useMicrosoftManagedNetwork": bool, + }, "privateEndpointConnections": [ { "etag": "str", @@ -171,7 +179,7 @@ async def test_begin_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -180,7 +188,7 @@ async def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_accounts_begin_update(self, resource_group): response = await ( await self.client.accounts.begin_update( resource_group_name=resource_group.name, @@ -203,6 +211,7 @@ async def test_begin_update(self, resource_group): "expiration": "2020-02-20 00:00:00", "rateLimitPercentage": 0.0, }, + "allowProjectManagement": bool, "allowedFqdnList": ["str"], "amlWorkspace": {"identityClientId": "str", "resourceId": "str"}, "apiProperties": { @@ -217,6 +226,7 @@ async def test_begin_update(self, resource_group): "superUser": "str", "websiteName": "str", }, + "associatedProjects": ["str"], "callRateLimit": { "count": 0.0, "renewalPeriod": 0.0, @@ -235,6 +245,7 @@ async def test_begin_update(self, resource_group): "commitmentPlanAssociations": [{"commitmentPlanId": "str", "commitmentPlanLocation": "str"}], "customSubDomainName": "str", "dateCreated": "str", + "defaultProject": "str", "deletionDate": "str", "disableLocalAuth": bool, "dynamicThrottlingEnabled": bool, @@ -264,6 +275,11 @@ async def test_begin_update(self, resource_group): {"id": "str", "ignoreMissingVnetServiceEndpoint": bool, "state": "str"} ], }, + "networkInjections": { + "scenario": "str", + "subnetArmId": "str", + "useMicrosoftManagedNetwork": bool, + }, "privateEndpointConnections": [ { "etag": "str", @@ -330,7 +346,7 @@ async def test_begin_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -339,12 +355,12 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_accounts_begin_delete(self, resource_group): response = await ( await self.client.accounts.begin_delete( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -353,11 +369,11 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_accounts_get(self, resource_group): response = await self.client.accounts.get( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -365,10 +381,10 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_accounts_list_by_resource_group(self, resource_group): response = self.client.accounts.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -376,9 +392,9 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_accounts_list(self, resource_group): response = self.client.accounts.list( - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -386,11 +402,11 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_keys(self, resource_group): + async def test_accounts_list_keys(self, resource_group): response = await self.client.accounts.list_keys( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -398,12 +414,12 @@ async def test_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_regenerate_key(self, resource_group): + async def test_accounts_regenerate_key(self, resource_group): response = await self.client.accounts.regenerate_key( resource_group_name=resource_group.name, account_name="str", key_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -411,11 +427,11 @@ async def test_regenerate_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_skus(self, resource_group): + async def test_accounts_list_skus(self, resource_group): response = await self.client.accounts.list_skus( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -423,11 +439,11 @@ async def test_list_skus(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_usages(self, resource_group): + async def test_accounts_list_usages(self, resource_group): response = await self.client.accounts.list_usages( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -435,11 +451,11 @@ async def test_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_models(self, resource_group): + async def test_accounts_list_models(self, resource_group): response = self.client.accounts.list_models( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_async.py index b1a297fc3938..a78e90b861a9 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_async.py @@ -27,7 +27,7 @@ async def test_check_sku_availability(self, resource_group): skus=["str"], kind="str", type="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ async def test_check_domain_availability(self, resource_group): response = await self.client.check_domain_availability( subdomain_name="str", type="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -49,7 +49,7 @@ async def test_check_domain_availability(self, resource_group): @recorded_by_proxy_async async def test_calculate_model_capacity(self, resource_group): response = await self.client.calculate_model_capacity( - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations.py index 3ea44faf297b..a783b2fa6648 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_commitment_plans_list(self, resource_group): response = self.client.commitment_plans.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_commitment_plans_get(self, resource_group): response = self.client.commitment_plans.get( resource_group_name=resource_group.name, account_name="str", commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_commitment_plans_create_or_update(self, resource_group): response = self.client.commitment_plans.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -97,7 +97,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -105,12 +105,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_commitment_plans_begin_delete(self, resource_group): response = self.client.commitment_plans.begin_delete( resource_group_name=resource_group.name, account_name="str", commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -118,7 +118,7 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update_plan(self, resource_group): + def test_commitment_plans_begin_create_or_update_plan(self, resource_group): response = self.client.commitment_plans.begin_create_or_update_plan( resource_group_name=resource_group.name, commitment_plan_name="str", @@ -169,7 +169,7 @@ def test_begin_create_or_update_plan(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -177,7 +177,7 @@ def test_begin_create_or_update_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update_plan(self, resource_group): + def test_commitment_plans_begin_update_plan(self, resource_group): response = self.client.commitment_plans.begin_update_plan( resource_group_name=resource_group.name, commitment_plan_name="str", @@ -185,7 +185,7 @@ def test_begin_update_plan(self, resource_group): "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -193,11 +193,11 @@ def test_begin_update_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_plan(self, resource_group): + def test_commitment_plans_begin_delete_plan(self, resource_group): response = self.client.commitment_plans.begin_delete_plan( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -205,11 +205,11 @@ def test_begin_delete_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_plan(self, resource_group): + def test_commitment_plans_get_plan(self, resource_group): response = self.client.commitment_plans.get_plan( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -217,10 +217,10 @@ def test_get_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_plans_by_resource_group(self, resource_group): + def test_commitment_plans_list_plans_by_resource_group(self, resource_group): response = self.client.commitment_plans.list_plans_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -228,9 +228,9 @@ def test_list_plans_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_plans_by_subscription(self, resource_group): + def test_commitment_plans_list_plans_by_subscription(self, resource_group): response = self.client.commitment_plans.list_plans_by_subscription( - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -238,11 +238,11 @@ def test_list_plans_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_associations(self, resource_group): + def test_commitment_plans_list_associations(self, resource_group): response = self.client.commitment_plans.list_associations( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -250,12 +250,12 @@ def test_list_associations(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get_association(self, resource_group): + def test_commitment_plans_get_association(self, resource_group): response = self.client.commitment_plans.get_association( resource_group_name=resource_group.name, commitment_plan_name="str", commitment_plan_association_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -263,7 +263,7 @@ def test_get_association(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update_association(self, resource_group): + def test_commitment_plans_begin_create_or_update_association(self, resource_group): response = self.client.commitment_plans.begin_create_or_update_association( resource_group_name=resource_group.name, commitment_plan_name="str", @@ -284,7 +284,7 @@ def test_begin_create_or_update_association(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -292,12 +292,12 @@ def test_begin_create_or_update_association(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete_association(self, resource_group): + def test_commitment_plans_begin_delete_association(self, resource_group): response = self.client.commitment_plans.begin_delete_association( resource_group_name=resource_group.name, commitment_plan_name="str", commitment_plan_association_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).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_commitment_plans_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations_async.py index 64b0e522673a..31e53b2bac0e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_plans_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_commitment_plans_list(self, resource_group): response = self.client.commitment_plans.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_commitment_plans_get(self, resource_group): response = await self.client.commitment_plans.get( resource_group_name=resource_group.name, account_name="str", commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_commitment_plans_create_or_update(self, resource_group): response = await self.client.commitment_plans.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -98,7 +98,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -106,13 +106,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_commitment_plans_begin_delete(self, resource_group): response = await ( await self.client.commitment_plans.begin_delete( resource_group_name=resource_group.name, account_name="str", commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -121,7 +121,7 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update_plan(self, resource_group): + async def test_commitment_plans_begin_create_or_update_plan(self, resource_group): response = await ( await self.client.commitment_plans.begin_create_or_update_plan( resource_group_name=resource_group.name, @@ -173,7 +173,7 @@ async def test_begin_create_or_update_plan(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -182,7 +182,7 @@ async def test_begin_create_or_update_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update_plan(self, resource_group): + async def test_commitment_plans_begin_update_plan(self, resource_group): response = await ( await self.client.commitment_plans.begin_update_plan( resource_group_name=resource_group.name, @@ -191,7 +191,7 @@ async def test_begin_update_plan(self, resource_group): "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -200,12 +200,12 @@ async def test_begin_update_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_plan(self, resource_group): + async def test_commitment_plans_begin_delete_plan(self, resource_group): response = await ( await self.client.commitment_plans.begin_delete_plan( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -214,11 +214,11 @@ async def test_begin_delete_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_plan(self, resource_group): + async def test_commitment_plans_get_plan(self, resource_group): response = await self.client.commitment_plans.get_plan( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -226,10 +226,10 @@ async def test_get_plan(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_plans_by_resource_group(self, resource_group): + async def test_commitment_plans_list_plans_by_resource_group(self, resource_group): response = self.client.commitment_plans.list_plans_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -237,9 +237,9 @@ async def test_list_plans_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_plans_by_subscription(self, resource_group): + async def test_commitment_plans_list_plans_by_subscription(self, resource_group): response = self.client.commitment_plans.list_plans_by_subscription( - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -247,11 +247,11 @@ async def test_list_plans_by_subscription(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_associations(self, resource_group): + async def test_commitment_plans_list_associations(self, resource_group): response = self.client.commitment_plans.list_associations( resource_group_name=resource_group.name, commitment_plan_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -259,12 +259,12 @@ async def test_list_associations(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get_association(self, resource_group): + async def test_commitment_plans_get_association(self, resource_group): response = await self.client.commitment_plans.get_association( resource_group_name=resource_group.name, commitment_plan_name="str", commitment_plan_association_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -272,7 +272,7 @@ async def test_get_association(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update_association(self, resource_group): + async def test_commitment_plans_begin_create_or_update_association(self, resource_group): response = await ( await self.client.commitment_plans.begin_create_or_update_association( resource_group_name=resource_group.name, @@ -294,7 +294,7 @@ async def test_begin_create_or_update_association(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -303,13 +303,13 @@ async def test_begin_create_or_update_association(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete_association(self, resource_group): + async def test_commitment_plans_begin_delete_association(self, resource_group): response = await ( await self.client.commitment_plans.begin_delete_association( resource_group_name=resource_group.name, commitment_plan_name="str", commitment_plan_association_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations.py index 98c9d9791e30..103da64a9de4 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_commitment_tiers_list(self, resource_group): response = self.client.commitment_tiers.list( location="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_commitment_tiers_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations_async.py index 70dca8f7cc01..1cdc6bc909c5 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_commitment_tiers_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_commitment_tiers_list(self, resource_group): response = self.client.commitment_tiers.list( location="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_defender_for_ai_settings_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations.py index f25c9d9b8460..bb6a1a74b0c1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_defender_for_ai_settings_list(self, resource_group): response = self.client.defender_for_ai_settings.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_defender_for_ai_settings_get(self, resource_group): response = self.client.defender_for_ai_settings.get( resource_group_name=resource_group.name, account_name="str", defender_for_ai_setting_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_defender_for_ai_settings_create_or_update(self, resource_group): response = self.client.defender_for_ai_settings.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -66,7 +66,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -74,7 +74,7 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_update(self, resource_group): + def test_defender_for_ai_settings_update(self, resource_group): response = self.client.defender_for_ai_settings.update( resource_group_name=resource_group.name, account_name="str", @@ -95,7 +95,7 @@ def test_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations_async.py index 68f2b58ee6cd..fb07d96b7c73 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_defender_for_ai_settings_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_defender_for_ai_settings_list(self, resource_group): response = self.client.defender_for_ai_settings.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_defender_for_ai_settings_get(self, resource_group): response = await self.client.defender_for_ai_settings.get( resource_group_name=resource_group.name, account_name="str", defender_for_ai_setting_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_defender_for_ai_settings_create_or_update(self, resource_group): response = await self.client.defender_for_ai_settings.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -67,7 +67,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -75,7 +75,7 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_update(self, resource_group): + async def test_defender_for_ai_settings_update(self, resource_group): response = await self.client.defender_for_ai_settings.update( resource_group_name=resource_group.name, account_name="str", @@ -96,7 +96,7 @@ async def test_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # 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 a74476dc88d1..510ea72816dd 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 @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_deleted_accounts_get(self, resource_group): response = self.client.deleted_accounts.get( location="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_purge(self, resource_group): + def test_deleted_accounts_begin_purge(self, resource_group): response = self.client.deleted_accounts.begin_purge( location="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -46,9 +46,9 @@ def test_begin_purge(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_deleted_accounts_list(self, resource_group): response = self.client.deleted_accounts.list( - api_version="2024-10-01", + api_version="2025-06-01", ) 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 a1d8b2241e32..421000c1af17 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 @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_deleted_accounts_get(self, resource_group): response = await self.client.deleted_accounts.get( location="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -34,13 +34,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_purge(self, resource_group): + async def test_deleted_accounts_begin_purge(self, resource_group): response = await ( await self.client.deleted_accounts.begin_purge( location="str", resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -49,9 +49,9 @@ async def test_begin_purge(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_deleted_accounts_list(self, resource_group): response = self.client.deleted_accounts.list( - api_version="2024-10-01", + api_version="2025-06-01", ) 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_deployments_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations.py index 15e401263208..e171e65298f1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_deployments_list(self, resource_group): response = self.client.deployments.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_deployments_get(self, resource_group): response = self.client.deployments.get( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_deployments_begin_create_or_update(self, resource_group): response = self.client.deployments.begin_create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -109,6 +109,7 @@ def test_begin_create_or_update(self, resource_group): } ], "scaleSettings": {"activeCapacity": 0, "capacity": 0, "scaleType": "str"}, + "spilloverDeploymentName": "str", "versionUpgradeOption": "str", }, "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, @@ -123,7 +124,7 @@ def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -131,7 +132,7 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_deployments_begin_update(self, resource_group): response = self.client.deployments.begin_update( resource_group_name=resource_group.name, account_name="str", @@ -140,7 +141,7 @@ def test_begin_update(self, resource_group): "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -148,12 +149,12 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_deployments_begin_delete(self, resource_group): response = self.client.deployments.begin_delete( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -161,12 +162,12 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_skus(self, resource_group): + def test_deployments_list_skus(self, resource_group): response = self.client.deployments.list_skus( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_deployments_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations_async.py index cacdffc9fe81..3efdab7bd230 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_deployments_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_deployments_list(self, resource_group): response = self.client.deployments.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_deployments_get(self, resource_group): response = await self.client.deployments.get( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_deployments_begin_create_or_update(self, resource_group): response = await ( await self.client.deployments.begin_create_or_update( resource_group_name=resource_group.name, @@ -111,6 +111,7 @@ async def test_begin_create_or_update(self, resource_group): } ], "scaleSettings": {"activeCapacity": 0, "capacity": 0, "scaleType": "str"}, + "spilloverDeploymentName": "str", "versionUpgradeOption": "str", }, "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, @@ -125,7 +126,7 @@ async def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -134,7 +135,7 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_deployments_begin_update(self, resource_group): response = await ( await self.client.deployments.begin_update( resource_group_name=resource_group.name, @@ -144,7 +145,7 @@ async def test_begin_update(self, resource_group): "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -153,13 +154,13 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_deployments_begin_delete(self, resource_group): response = await ( await self.client.deployments.begin_delete( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -168,12 +169,12 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_skus(self, resource_group): + async def test_deployments_list_skus(self, resource_group): response = self.client.deployments.list_skus( resource_group_name=resource_group.name, account_name="str", deployment_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_encryption_scopes_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations.py index d967c0ff45c4..1cd1551ee240 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_encryption_scopes_list(self, resource_group): response = self.client.encryption_scopes.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_encryption_scopes_get(self, resource_group): response = self.client.encryption_scopes.get( resource_group_name=resource_group.name, account_name="str", encryption_scope_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_encryption_scopes_create_or_update(self, resource_group): response = self.client.encryption_scopes.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -76,7 +76,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -84,12 +84,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_encryption_scopes_begin_delete(self, resource_group): response = self.client.encryption_scopes.begin_delete( resource_group_name=resource_group.name, account_name="str", encryption_scope_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).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_encryption_scopes_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations_async.py index 850573c72894..10ae1a1e3f0c 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_encryption_scopes_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_encryption_scopes_list(self, resource_group): response = self.client.encryption_scopes.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_encryption_scopes_get(self, resource_group): response = await self.client.encryption_scopes.get( resource_group_name=resource_group.name, account_name="str", encryption_scope_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_encryption_scopes_create_or_update(self, resource_group): response = await self.client.encryption_scopes.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -77,7 +77,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -85,13 +85,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_encryption_scopes_begin_delete(self, resource_group): response = await ( await self.client.encryption_scopes.begin_delete( resource_group_name=resource_group.name, account_name="str", encryption_scope_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations.py index 4d0a27d8ec07..771ed43314b7 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations.py @@ -20,13 +20,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_location_based_model_capacities_list(self, resource_group): response = self.client.location_based_model_capacities.list( location="str", model_format="str", model_name="str", model_version="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_location_based_model_capacities_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations_async.py index c6cacad33717..4f9101333361 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_location_based_model_capacities_operations_async.py @@ -21,13 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_location_based_model_capacities_list(self, resource_group): response = self.client.location_based_model_capacities.list( location="str", model_format="str", model_name="str", model_version="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_model_capacities_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations.py index c156fa2436d6..3708391c32a1 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_model_capacities_list(self, resource_group): response = self.client.model_capacities.list( model_format="str", model_name="str", model_version="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_model_capacities_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations_async.py index e95828958954..621cd3144316 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_model_capacities_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_model_capacities_list(self, resource_group): response = self.client.model_capacities.list( model_format="str", model_name="str", model_version="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_models_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations.py index faea0ec9f7f8..598fbde2d3d2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_models_list(self, resource_group): response = self.client.models.list( location="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_models_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations_async.py index ad64b9c72310..90f6c9d76e6d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_models_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_models_list(self, resource_group): response = self.client.models.list( location="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_network_security_perimeter_configurations_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations.py index 7f07dcf36d59..066cba2a664b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_network_security_perimeter_configurations_list(self, resource_group): response = self.client.network_security_perimeter_configurations.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_network_security_perimeter_configurations_get(self, resource_group): response = self.client.network_security_perimeter_configurations.get( resource_group_name=resource_group.name, account_name="str", nsp_configuration_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,12 +45,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_reconcile(self, resource_group): + def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): response = self.client.network_security_perimeter_configurations.begin_reconcile( resource_group_name=resource_group.name, account_name="str", nsp_configuration_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).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_network_security_perimeter_configurations_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations_async.py index 828da45f5710..fe3d77573967 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_network_security_perimeter_configurations_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_network_security_perimeter_configurations_list(self, resource_group): response = self.client.network_security_perimeter_configurations.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_network_security_perimeter_configurations_get(self, resource_group): response = await self.client.network_security_perimeter_configurations.get( resource_group_name=resource_group.name, account_name="str", nsp_configuration_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,13 +46,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_reconcile(self, resource_group): + async def test_network_security_perimeter_configurations_begin_reconcile(self, resource_group): response = await ( await self.client.network_security_perimeter_configurations.begin_reconcile( resource_group_name=resource_group.name, account_name="str", nsp_configuration_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations.py index c66de343c10a..c39e70597dee 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-10-01", + api_version="2025-06-01", ) 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_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations_async.py index 48ba34c38069..499b6e80b6a2 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-10-01", + api_version="2025-06-01", ) 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_private_endpoint_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations.py index efd140ede911..fc5920059e6b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_private_endpoint_connections_list(self, resource_group): response = self.client.private_endpoint_connections.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_private_endpoint_connections_get(self, resource_group): response = self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create_or_update(self, resource_group): + def test_private_endpoint_connections_begin_create_or_update(self, resource_group): response = self.client.private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -75,7 +75,7 @@ def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -83,12 +83,12 @@ def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_private_endpoint_connections_begin_delete(self, resource_group): response = self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).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_private_endpoint_connections_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations_async.py index d4c54f0c819d..6c68c08ba661 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_endpoint_connections_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_private_endpoint_connections_list(self, resource_group): response = await self.client.private_endpoint_connections.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_private_endpoint_connections_get(self, resource_group): response = await self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create_or_update(self, resource_group): + async def test_private_endpoint_connections_begin_create_or_update(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_create_or_update( resource_group_name=resource_group.name, @@ -77,7 +77,7 @@ async def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -86,13 +86,13 @@ async def test_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_private_endpoint_connections_begin_delete(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, account_name="str", private_endpoint_connection_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations.py index 269f8ab124e2..868a9c96231b 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_private_link_resources_list(self, resource_group): response = self.client.private_link_resources.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations_async.py index c0e569ca22da..238d65b29515 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_private_link_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_private_link_resources_list(self, resource_group): response = await self.client.private_link_resources.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations.py new file mode 100644 index 000000000000..4e77820bf555 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations.py @@ -0,0 +1,77 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementProjectCapabilityHostsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_capability_hosts_begin_delete(self, resource_group): + response = self.client.project_capability_hosts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + api_version="2025-06-01", + ).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_project_capability_hosts_get(self, resource_group): + response = self.client.project_capability_hosts.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_capability_hosts_begin_create_or_update(self, resource_group): + response = self.client.project_capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + capability_host={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "threadStorageConnections": ["str"], + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2025-06-01", + ).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_project_capability_hosts_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations_async.py new file mode 100644 index 000000000000..56391d9e823c --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_capability_hosts_operations_async.py @@ -0,0 +1,82 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementProjectCapabilityHostsOperationsAsync(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_project_capability_hosts_begin_delete(self, resource_group): + response = await ( + await self.client.project_capability_hosts.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + api_version="2025-06-01", + ) + ).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_project_capability_hosts_get(self, resource_group): + response = await self.client.project_capability_hosts.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_capability_hosts_begin_create_or_update(self, resource_group): + response = await ( + await self.client.project_capability_hosts.begin_create_or_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + capability_host_name="str", + capability_host={ + "properties": { + "aiServicesConnections": ["str"], + "capabilityHostKind": "str", + "customerSubnet": "str", + "description": "str", + "provisioningState": "str", + "storageConnections": ["str"], + "tags": {"str": "str"}, + "threadStorageConnections": ["str"], + "vectorStoreConnections": ["str"], + }, + "id": "str", + "name": "str", + "type": "str", + }, + api_version="2025-06-01", + ) + ).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_project_connections_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connections_operations.py new file mode 100644 index 000000000000..086dca737620 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connections_operations.py @@ -0,0 +1,88 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementProjectConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connections_delete(self, resource_group): + response = self.client.project_connections.delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connections_get(self, resource_group): + response = self.client.project_connections.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connections_update(self, resource_group): + response = self.client.project_connections.update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connections_create(self, resource_group): + response = self.client.project_connections.create( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_project_connections_list(self, resource_group): + response = self.client.project_connections.list( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-06-01", + ) + 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_project_connections_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connections_operations_async.py new file mode 100644 index 000000000000..eaa8f177bac8 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_project_connections_operations_async.py @@ -0,0 +1,89 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementProjectConnectionsOperationsAsync(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_project_connections_delete(self, resource_group): + response = await self.client.project_connections.delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connections_get(self, resource_group): + response = await self.client.project_connections.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connections_update(self, resource_group): + response = await self.client.project_connections.update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connections_create(self, resource_group): + response = await self.client.project_connections.create( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + connection_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_project_connections_list(self, resource_group): + response = self.client.project_connections.list( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-06-01", + ) + 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_projects_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations.py new file mode 100644 index 000000000000..71204a65dfe8 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations.py @@ -0,0 +1,141 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementProjectsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(CognitiveServicesManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_projects_begin_create(self, resource_group): + response = self.client.projects.begin_create( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + project={ + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "description": "str", + "displayName": "str", + "endpoints": {"str": "str"}, + "isDefault": bool, + "provisioningState": "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", + }, + api_version="2025-06-01", + ).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_projects_begin_update(self, resource_group): + response = self.client.projects.begin_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + project={ + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "description": "str", + "displayName": "str", + "endpoints": {"str": "str"}, + "isDefault": bool, + "provisioningState": "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", + }, + api_version="2025-06-01", + ).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_projects_begin_delete(self, resource_group): + response = self.client.projects.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-06-01", + ).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_projects_get(self, resource_group): + response = self.client.projects.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_projects_list(self, resource_group): + response = self.client.projects.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2025-06-01", + ) + 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_projects_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations_async.py new file mode 100644 index 000000000000..d48f2fb4f444 --- /dev/null +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_projects_operations_async.py @@ -0,0 +1,148 @@ +# 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) AutoRest 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 TestCognitiveServicesManagementProjectsOperationsAsync(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_projects_begin_create(self, resource_group): + response = await ( + await self.client.projects.begin_create( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + project={ + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "description": "str", + "displayName": "str", + "endpoints": {"str": "str"}, + "isDefault": bool, + "provisioningState": "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", + }, + api_version="2025-06-01", + ) + ).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_projects_begin_update(self, resource_group): + response = await ( + await self.client.projects.begin_update( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + project={ + "etag": "str", + "id": "str", + "identity": { + "principalId": "str", + "tenantId": "str", + "type": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "description": "str", + "displayName": "str", + "endpoints": {"str": "str"}, + "isDefault": bool, + "provisioningState": "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", + }, + api_version="2025-06-01", + ) + ).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_projects_begin_delete(self, resource_group): + response = await ( + await self.client.projects.begin_delete( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-06-01", + ) + ).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_projects_get(self, resource_group): + response = await self.client.projects.get( + resource_group_name=resource_group.name, + account_name="str", + project_name="str", + api_version="2025-06-01", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_projects_list(self, resource_group): + response = self.client.projects.list( + resource_group_name=resource_group.name, + account_name="str", + api_version="2025-06-01", + ) + 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_blocklist_items_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations.py index 024fcc253dab..bd7026a27343 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations.py @@ -20,12 +20,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_rai_blocklist_items_list(self, resource_group): response = self.client.rai_blocklist_items.list( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,13 +33,13 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_rai_blocklist_items_get(self, resource_group): response = self.client.rai_blocklist_items.get( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_item_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -47,7 +47,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_rai_blocklist_items_create_or_update(self, resource_group): response = self.client.rai_blocklist_items.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -69,7 +69,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -77,13 +77,13 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_rai_blocklist_items_begin_delete(self, resource_group): response = self.client.rai_blocklist_items.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_item_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -91,13 +91,13 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_batch_add(self, resource_group): + def test_rai_blocklist_items_batch_add(self, resource_group): response = self.client.rai_blocklist_items.batch_add( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_items=[{"name": "str", "properties": {"isRegex": bool, "pattern": "str"}}], - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -105,13 +105,13 @@ def test_batch_add(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_batch_delete(self, resource_group): + def test_rai_blocklist_items_batch_delete(self, resource_group): response = self.client.rai_blocklist_items.batch_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_items_names={}, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations_async.py index d1fbf3a58f36..499e550fee5e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklist_items_operations_async.py @@ -21,12 +21,12 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_rai_blocklist_items_list(self, resource_group): response = self.client.rai_blocklist_items.list( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,13 +34,13 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_rai_blocklist_items_get(self, resource_group): response = await self.client.rai_blocklist_items.get( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_item_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -48,7 +48,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_rai_blocklist_items_create_or_update(self, resource_group): response = await self.client.rai_blocklist_items.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -70,7 +70,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -78,14 +78,14 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_rai_blocklist_items_begin_delete(self, resource_group): response = await ( await self.client.rai_blocklist_items.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_item_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result @@ -94,13 +94,13 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_batch_add(self, resource_group): + async def test_rai_blocklist_items_batch_add(self, resource_group): response = await self.client.rai_blocklist_items.batch_add( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_items=[{"name": "str", "properties": {"isRegex": bool, "pattern": "str"}}], - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -108,13 +108,13 @@ async def test_batch_add(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_batch_delete(self, resource_group): + async def test_rai_blocklist_items_batch_delete(self, resource_group): response = await self.client.rai_blocklist_items.batch_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", rai_blocklist_items_names={}, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations.py index 8e8560968797..700ced4e72eb 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_rai_blocklists_list(self, resource_group): response = self.client.rai_blocklists.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_rai_blocklists_get(self, resource_group): response = self.client.rai_blocklists.get( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_rai_blocklists_create_or_update(self, resource_group): response = self.client.rai_blocklists.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -66,7 +66,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -74,12 +74,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_rai_blocklists_begin_delete(self, resource_group): response = self.client.rai_blocklists.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).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_rai_blocklists_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations_async.py index fb192a693373..548ced635737 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_blocklists_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_rai_blocklists_list(self, resource_group): response = self.client.rai_blocklists.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_rai_blocklists_get(self, resource_group): response = await self.client.rai_blocklists.get( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_rai_blocklists_create_or_update(self, resource_group): response = await self.client.rai_blocklists.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -67,7 +67,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -75,13 +75,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_rai_blocklists_begin_delete(self, resource_group): response = await ( await self.client.rai_blocklists.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_blocklist_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations.py index fa1c0083fc96..8409db7fa5ce 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_rai_content_filters_list(self, resource_group): response = self.client.rai_content_filters.list( location="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -31,11 +31,11 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_rai_content_filters_get(self, resource_group): response = self.client.rai_content_filters.get( location="str", filter_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations_async.py index bfc8ec002236..dfde159d1249 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_content_filters_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_rai_content_filters_list(self, resource_group): response = self.client.rai_content_filters.list( location="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -32,11 +32,11 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_rai_content_filters_get(self, resource_group): response = await self.client.rai_content_filters.get( location="str", filter_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # 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 80308b75060b..71e39d8b75cc 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 @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_rai_policies_list(self, resource_group): response = self.client.rai_policies.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_rai_policies_get(self, resource_group): response = self.client.rai_policies.get( resource_group_name=resource_group.name, account_name="str", rai_policy_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_create_or_update(self, resource_group): + def test_rai_policies_create_or_update(self, resource_group): response = self.client.rai_policies.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -74,7 +74,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -82,12 +82,12 @@ def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_rai_policies_begin_delete(self, resource_group): response = self.client.rai_policies.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_policy_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ).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_rai_policies_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_rai_policies_operations_async.py index a74b7a510680..d62da3a5364f 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 @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_rai_policies_list(self, resource_group): response = self.client.rai_policies.list( resource_group_name=resource_group.name, account_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_rai_policies_get(self, resource_group): response = await self.client.rai_policies.get( resource_group_name=resource_group.name, account_name="str", rai_policy_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_create_or_update(self, resource_group): + async def test_rai_policies_create_or_update(self, resource_group): response = await self.client.rai_policies.create_or_update( resource_group_name=resource_group.name, account_name="str", @@ -75,7 +75,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-10-01", + api_version="2025-06-01", ) # please add some check logic here by yourself @@ -83,13 +83,13 @@ async def test_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_rai_policies_begin_delete(self, resource_group): response = await ( await self.client.rai_policies.begin_delete( resource_group_name=resource_group.name, account_name="str", rai_policy_name="str", - api_version="2024-10-01", + api_version="2025-06-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations.py index 387f49b4e85f..950a656da372 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_resource_skus_list(self, resource_group): response = self.client.resource_skus.list( - api_version="2024-10-01", + api_version="2025-06-01", ) 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_resource_skus_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations_async.py index 0b68fd9d6db6..d8957b588267 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_resource_skus_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_resource_skus_list(self, resource_group): response = self.client.resource_skus.list( - api_version="2024-10-01", + api_version="2025-06-01", ) 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_usages_operations.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations.py index 2dc319f5c8ad..9351c9e07fb6 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations.py @@ -20,10 +20,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_usages_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2024-10-01", + api_version="2025-06-01", ) 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_usages_operations_async.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations_async.py index fed20f87d97d..e0c675c6843e 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations_async.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_tests/test_cognitive_services_management_usages_operations_async.py @@ -21,10 +21,10 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_usages_list(self, resource_group): response = self.client.usages.list( location="str", - api_version="2024-10-01", + api_version="2025-06-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py index cc77219a7545..9299d5486f2d 100644 --- a/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py +++ b/sdk/cognitiveservices/azure-mgmt-cognitiveservices/setup.py @@ -22,11 +22,9 @@ # Version extraction inspired from 'requests' with open( - ( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py") - ), + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), "r", ) as fd: version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) @@ -55,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -79,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )