From a9ecfe06ff7620bbfb92aee45d57739b47579d39 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 27 Mar 2026 21:15:16 +0000 Subject: [PATCH] Configurations: 'specification/search/resource-manager/Microsoft.Search/Search/tspconfig.yaml', API Version: 2026-03-01-preview, SDK Release Type: beta, and CommitSHA: 'f90ba8622a186403cc11d43b8977d6bfd8410742' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6075078 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/search/azure-mgmt-search/CHANGELOG.md | 80 + sdk/search/azure-mgmt-search/MANIFEST.in | 9 +- sdk/search/azure-mgmt-search/_meta.json | 11 - sdk/search/azure-mgmt-search/_metadata.json | 10 + .../azure-mgmt-search/apiview-properties.json | 147 + .../azure-mgmt-search/azure/__init__.py | 2 +- .../azure-mgmt-search/azure/mgmt/__init__.py | 2 +- .../azure/mgmt/search/__init__.py | 4 +- ...search_management_client.py => _client.py} | 98 +- .../azure/mgmt/search/_configuration.py | 33 +- .../azure/mgmt/search/_patch.py | 13 +- .../azure/mgmt/search/_utils/__init__.py | 2 +- .../azure/mgmt/search/_utils/model_base.py | 1350 ++++++ .../azure/mgmt/search/_utils/serialization.py | 45 +- .../azure/mgmt/search/_utils/utils.py | 2 +- .../azure/mgmt/search/_validation.py | 66 + .../azure/mgmt/search/_version.py | 4 +- .../azure/mgmt/search/aio/__init__.py | 4 +- ...search_management_client.py => _client.py} | 100 +- .../azure/mgmt/search/aio/_configuration.py | 33 +- .../azure/mgmt/search/aio/_patch.py | 13 +- .../mgmt/search/aio/operations/__init__.py | 34 +- .../aio/operations/_admin_keys_operations.py | 204 - ...ity_perimeter_configurations_operations.py | 327 -- .../mgmt/search/aio/operations/_operations.py | 3351 ++++++++++++- .../mgmt/search/aio/operations/_patch.py | 13 +- ...private_endpoint_connections_operations.py | 494 -- .../_private_link_resources_operations.py | 152 - .../aio/operations/_query_keys_operations.py | 310 -- .../_search_management_client_operations.py | 107 - .../aio/operations/_services_operations.py | 988 ---- ...hared_private_link_resources_operations.py | 626 --- .../aio/operations/_usages_operations.py | 146 - .../azure/mgmt/search/models/__init__.py | 54 +- ...h_management_client_enums.py => _enums.py} | 130 +- .../azure/mgmt/search/models/_models.py | 2531 ++++++++++ .../azure/mgmt/search/models/_models_py3.py | 2591 ---------- .../azure/mgmt/search/models/_patch.py | 13 +- .../azure/mgmt/search/operations/__init__.py | 34 +- .../operations/_admin_keys_operations.py | 289 -- ...ity_perimeter_configurations_operations.py | 440 -- .../mgmt/search/operations/_operations.py | 4148 ++++++++++++++++- .../azure/mgmt/search/operations/_patch.py | 13 +- ...private_endpoint_connections_operations.py | 665 --- .../_private_link_resources_operations.py | 195 - .../operations/_query_keys_operations.py | 432 -- .../_search_management_client_operations.py | 142 - .../search/operations/_services_operations.py | 1254 ----- ...hared_private_link_resources_operations.py | 795 ---- .../search/operations/_usages_operations.py | 179 - ..._or_update_shared_private_link_resource.py | 6 +- .../delete_private_endpoint_connection.py | 7 +- .../delete_shared_private_link_resource.py | 7 +- .../get_private_endpoint_connection.py | 7 +- .../generated_samples/get_quota_usage.py | 7 +- .../get_quota_usages_list.py | 7 +- .../get_shared_private_link_resource.py | 7 +- ...private_endpoint_connections_by_service.py | 7 +- ...hared_private_link_resources_by_service.py | 7 +- .../list_supported_private_link_resources.py | 7 +- ...k_security_perimeter_configurations_get.py | 7 +- ...erimeter_configurations_list_by_service.py | 7 +- ...rity_perimeter_configurations_reconcile.py | 7 +- .../search_check_name_availability.py | 41 + .../search_create_or_update_service.py | 9 +- ...h_create_or_update_service_auth_options.py | 11 +- ...te_or_update_service_disable_local_auth.py | 11 +- ..._to_allow_access_from_private_endpoints.py | 13 +- ..._to_allow_access_from_public_custom_ips.py | 11 +- ...ccess_from_public_custom_ips_and_bypass.py | 13 +- ..._or_update_service_with_cmk_enforcement.py | 11 +- ...r_update_service_with_data_exfiltration.py | 11 +- ..._create_or_update_service_with_identity.py | 8 +- ...reate_or_update_service_with_serverless.py | 48 + ...vel_cmk_multi_tenant_federated_identity.py | 74 + ...eate_or_update_with_knowledge_retrieval.py | 54 + ...h_create_or_update_with_semantic_search.py | 11 +- .../search_create_query_key.py | 7 +- .../search_delete_query_key.py | 7 +- .../search_delete_service.py | 7 +- .../search_get_admin_keys.py | 7 +- .../generated_samples/search_get_service.py | 7 +- .../search_list_offerings.py | 39 + .../search_list_operations.py | 5 +- ...earch_list_query_keys_by_search_service.py | 7 +- .../search_list_services_by_resource_group.py | 7 +- .../search_list_services_by_subscription.py | 7 +- .../search_regenerate_admin_key.py | 7 +- .../search_update_service.py | 7 +- .../search_update_service_auth_options.py | 7 +- ...earch_update_service_disable_local_auth.py | 7 +- ..._to_allow_access_from_private_endpoints.py | 9 +- ..._to_allow_access_from_public_custom_ips.py | 11 +- ...ccess_from_public_custom_ips_and_bypass.py | 11 +- ...earch_update_service_to_remove_identity.py | 7 +- ...rch_update_service_with_cmk_enforcement.py | 7 +- ...h_update_service_with_data_exfiltration.py | 7 +- ...update_service_with_knowledge_retrieval.py | 46 + ...rch_update_service_with_semantic_search.py | 7 +- .../search_update_service_with_sku.py | 7 +- .../update_private_endpoint_connection.py | 11 +- ...pgrade_search_service_to_latest_version.py | 7 +- .../generated_tests/conftest.py | 2 +- .../generated_tests/test_search_management.py | 3 +- ...search_management_admin_keys_operations.py | 4 +- ..._management_admin_keys_operations_async.py | 4 +- .../test_search_management_async.py | 3 +- ...ity_perimeter_configurations_operations.py | 19 +- ...rimeter_configurations_operations_async.py | 19 +- ..._search_management_offerings_operations.py | 8 +- ...h_management_offerings_operations_async.py | 8 +- .../test_search_management_operations.py | 6 +- ...test_search_management_operations_async.py | 6 +- ...private_endpoint_connections_operations.py | 32 +- ...e_endpoint_connections_operations_async.py | 32 +- ...ement_private_link_resources_operations.py | 3 +- ...private_link_resources_operations_async.py | 3 +- ...search_management_query_keys_operations.py | 5 +- ..._management_query_keys_operations_async.py | 5 +- ...st_search_management_service_operations.py | 31 - ...rch_management_service_operations_async.py | 34 - ...t_search_management_services_operations.py | 338 +- ...ch_management_services_operations_async.py | 304 +- ...hared_private_link_resources_operations.py | 30 +- ...private_link_resources_operations_async.py | 30 +- ...est_search_management_usages_operations.py | 3 +- ...arch_management_usages_operations_async.py | 3 +- sdk/search/azure-mgmt-search/pyproject.toml | 82 + .../azure-mgmt-search/sdk_packaging.toml | 9 - sdk/search/azure-mgmt-search/setup.py | 82 - .../azure-mgmt-search/tsp-location.yaml | 4 + 131 files changed, 13013 insertions(+), 11458 deletions(-) delete mode 100644 sdk/search/azure-mgmt-search/_meta.json create mode 100644 sdk/search/azure-mgmt-search/_metadata.json create mode 100644 sdk/search/azure-mgmt-search/apiview-properties.json rename sdk/search/azure-mgmt-search/azure/mgmt/search/{_search_management_client.py => _client.py} (75%) create mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/model_base.py create mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/_validation.py rename sdk/search/azure-mgmt-search/azure/mgmt/search/aio/{_search_management_client.py => _client.py} (76%) delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_network_security_perimeter_configurations_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_search_management_client_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_usages_operations.py rename sdk/search/azure-mgmt-search/azure/mgmt/search/models/{_search_management_client_enums.py => _enums.py} (81%) create mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_network_security_perimeter_configurations_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_search_management_client_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py delete mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_usages_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_check_name_availability.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_serverless.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_service_level_cmk_multi_tenant_federated_identity.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_knowledge_retrieval.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_list_offerings.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_knowledge_retrieval.py delete mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_service_operations.py delete mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_service_operations_async.py delete mode 100644 sdk/search/azure-mgmt-search/sdk_packaging.toml delete mode 100644 sdk/search/azure-mgmt-search/setup.py create mode 100644 sdk/search/azure-mgmt-search/tsp-location.yaml diff --git a/sdk/search/azure-mgmt-search/CHANGELOG.md b/sdk/search/azure-mgmt-search/CHANGELOG.md index ed606a895a6b..0643adbfc0c4 100644 --- a/sdk/search/azure-mgmt-search/CHANGELOG.md +++ b/sdk/search/azure-mgmt-search/CHANGELOG.md @@ -1,5 +1,85 @@ # Release History +## 10.0.0b1 (2026-03-27) + +### Features Added + + - Model `SearchManagementClient` added parameter `cloud_setting` in method `__init__` + - Client `SearchManagementClient` added method `send_request` + - Client `SearchManagementClient` added operation group `offerings` + - Model `CheckNameAvailabilityInput` added property `type` + - Model `EncryptionWithCmk` added property `service_level_encryption_key` + - Enum `SearchBypass` added member `AZURE_PORTAL` + - Model `SearchServiceUpdate` added property `properties` + - Enum `SkuName` added member `SERVERLESS` + - Added model `AzureActiveDirectoryApplicationCredentials` + - Added model `CloudError` + - Added model `DataIdentity` + - Added model `DataNoneIdentity` + - Added model `DataUserAssignedIdentity` + - Added model `FeatureOffering` + - Added enum `KnowledgeRetrieval` + - Added model `OfferingsByRegion` + - Added model `OfferingsListResult` + - Added model `SearchResourceEncryptionKey` + - Added model `SkuLimits` + - Added model `SkuOffering` + - Added model `OfferingsOperations` + +### Breaking Changes + + - Method `SearchManagementClient.usage_by_subscription_sku` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `replica_count` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `partition_count` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `endpoint` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `hosting_mode` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `compute_type` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `public_network_access` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `status` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `status_details` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `provisioning_state` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `network_rule_set` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `data_exfiltration_protections` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `encryption_with_cmk` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `disable_local_auth` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `auth_options` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `semantic_search` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `private_endpoint_connections` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `shared_private_link_resources` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `e_tag` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `upgrade_available` + - Model `SearchServiceUpdate` deleted or renamed its instance variable `service_upgraded_at` + - Deleted or renamed model `AsyncOperationResult` + - Deleted or renamed model `ListQueryKeysResult` + - Deleted or renamed model `PrivateLinkResourcesResult` + - Deleted or renamed model `SearchManagementRequestOptions` + - Deleted or renamed model `SharedPrivateLinkResourceAsyncOperationResult` + - Method `AdminKeysOperations.get` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `AdminKeysOperations.regenerate` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `PrivateEndpointConnectionsOperations.delete` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `PrivateEndpointConnectionsOperations.get` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `PrivateEndpointConnectionsOperations.list_by_service` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `PrivateEndpointConnectionsOperations.update` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `PrivateLinkResourcesOperations.list_supported` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `QueryKeysOperations.create` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `QueryKeysOperations.delete` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `QueryKeysOperations.list_by_search_service` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `ServicesOperations.begin_create_or_update` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `ServicesOperations.check_name_availability` inserted a `positional_or_keyword` parameter `check_name_availability_input` + - Method `ServicesOperations.check_name_availability` deleted or renamed its parameter `name` of kind `positional_or_keyword` + - Method `ServicesOperations.check_name_availability` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `ServicesOperations.delete` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `ServicesOperations.get` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `ServicesOperations.list_by_resource_group` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `ServicesOperations.list_by_subscription` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `ServicesOperations.update` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `SharedPrivateLinkResourcesOperations.begin_create_or_update` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `SharedPrivateLinkResourcesOperations.begin_delete` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `SharedPrivateLinkResourcesOperations.get` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `SharedPrivateLinkResourcesOperations.list_by_service` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Method `UsagesOperations.list_by_subscription` deleted or renamed its parameter `search_management_request_options` of kind `positional_or_keyword` + - Deleted or renamed model `SearchManagementClientOperationsMixin` + ## 9.2.0 (2025-07-21) ### Features Added diff --git a/sdk/search/azure-mgmt-search/MANIFEST.in b/sdk/search/azure-mgmt-search/MANIFEST.in index 0cb72ffc2d85..d4d2260014d1 100644 --- a/sdk/search/azure-mgmt-search/MANIFEST.in +++ b/sdk/search/azure-mgmt-search/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/search/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/search/azure-mgmt-search/_meta.json b/sdk/search/azure-mgmt-search/_meta.json deleted file mode 100644 index 11dbf77abfe8..000000000000 --- a/sdk/search/azure-mgmt-search/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "11059b2f00c7572b276dc9862c0b41db8702cc78", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.34.1", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/search/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.34.1 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/search/resource-manager/readme.md" -} \ No newline at end of file diff --git a/sdk/search/azure-mgmt-search/_metadata.json b/sdk/search/azure-mgmt-search/_metadata.json new file mode 100644 index 000000000000..d8433d48a23d --- /dev/null +++ b/sdk/search/azure-mgmt-search/_metadata.json @@ -0,0 +1,10 @@ +{ + "apiVersion": "2026-03-01-preview", + "apiVersions": { + "Microsoft.Search": "2026-03-01-preview" + }, + "commit": "f90ba8622a186403cc11d43b8977d6bfd8410742", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/search/resource-manager/Microsoft.Search/Search", + "emitterVersion": "0.61.2" +} \ No newline at end of file diff --git a/sdk/search/azure-mgmt-search/apiview-properties.json b/sdk/search/azure-mgmt-search/apiview-properties.json new file mode 100644 index 000000000000..f8dd5be34006 --- /dev/null +++ b/sdk/search/azure-mgmt-search/apiview-properties.json @@ -0,0 +1,147 @@ +{ + "CrossLanguagePackageId": "Microsoft.Search", + "CrossLanguageDefinitionId": { + "azure.mgmt.search.models.AccessRule": "Azure.ResourceManager.CommonTypes.AccessRule", + "azure.mgmt.search.models.AccessRuleProperties": "Azure.ResourceManager.CommonTypes.AccessRuleProperties", + "azure.mgmt.search.models.AccessRulePropertiesSubscriptionsItem": "Microsoft.Search.AccessRulePropertiesSubscriptionsItem", + "azure.mgmt.search.models.AdminKeyResult": "Microsoft.Search.AdminKeyResult", + "azure.mgmt.search.models.AzureActiveDirectoryApplicationCredentials": "Microsoft.Search.AzureActiveDirectoryApplicationCredentials", + "azure.mgmt.search.models.CheckNameAvailabilityInput": "Microsoft.Search.CheckNameAvailabilityInput", + "azure.mgmt.search.models.CheckNameAvailabilityOutput": "Microsoft.Search.CheckNameAvailabilityOutput", + "azure.mgmt.search.models.CloudError": "Microsoft.Search.CloudError", + "azure.mgmt.search.models.CloudErrorBody": "Microsoft.Search.CloudErrorBody", + "azure.mgmt.search.models.DataIdentity": "Microsoft.Search.DataIdentity", + "azure.mgmt.search.models.DataNoneIdentity": "Microsoft.Search.DataNoneIdentity", + "azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption": "Microsoft.Search.DataPlaneAadOrApiKeyAuthOption", + "azure.mgmt.search.models.DataPlaneAuthOptions": "Microsoft.Search.DataPlaneAuthOptions", + "azure.mgmt.search.models.DataUserAssignedIdentity": "Microsoft.Search.DataUserAssignedIdentity", + "azure.mgmt.search.models.EncryptionWithCmk": "Microsoft.Search.EncryptionWithCmk", + "azure.mgmt.search.models.FeatureOffering": "Microsoft.Search.FeatureOffering", + "azure.mgmt.search.models.Identity": "Microsoft.Search.Identity", + "azure.mgmt.search.models.IpRule": "Microsoft.Search.IpRule", + "azure.mgmt.search.models.NetworkRuleSet": "Microsoft.Search.NetworkRuleSet", + "azure.mgmt.search.models.NetworkSecurityPerimeter": "Azure.ResourceManager.CommonTypes.NetworkSecurityPerimeter", + "azure.mgmt.search.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.search.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration": "Microsoft.Search.NetworkSecurityPerimeterConfiguration", + "azure.mgmt.search.models.NetworkSecurityPerimeterConfigurationProperties": "Azure.ResourceManager.CommonTypes.NetworkSecurityPerimeterConfigurationProperties", + "azure.mgmt.search.models.NetworkSecurityProfile": "Azure.ResourceManager.CommonTypes.NetworkSecurityProfile", + "azure.mgmt.search.models.OfferingsByRegion": "Microsoft.Search.OfferingsByRegion", + "azure.mgmt.search.models.OfferingsListResult": "Microsoft.Search.OfferingsListResult", + "azure.mgmt.search.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.search.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.search.models.PrivateEndpointConnection": "Microsoft.Search.PrivateEndpointConnection", + "azure.mgmt.search.models.PrivateEndpointConnectionProperties": "Microsoft.Search.PrivateEndpointConnectionProperties", + "azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateEndpoint": "Microsoft.Search.PrivateEndpointConnectionPropertiesPrivateEndpoint", + "azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState": "Microsoft.Search.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState", + "azure.mgmt.search.models.PrivateLinkResource": "Microsoft.Search.PrivateLinkResource", + "azure.mgmt.search.models.PrivateLinkResourceProperties": "Microsoft.Search.PrivateLinkResourceProperties", + "azure.mgmt.search.models.ProvisioningIssue": "Azure.ResourceManager.CommonTypes.ProvisioningIssue", + "azure.mgmt.search.models.ProvisioningIssueProperties": "Azure.ResourceManager.CommonTypes.ProvisioningIssueProperties", + "azure.mgmt.search.models.QueryKey": "Microsoft.Search.QueryKey", + "azure.mgmt.search.models.QuotaUsageResult": "Microsoft.Search.QuotaUsageResult", + "azure.mgmt.search.models.QuotaUsageResultName": "Microsoft.Search.QuotaUsageResultName", + "azure.mgmt.search.models.ResourceAssociation": "Azure.ResourceManager.CommonTypes.ResourceAssociation", + "azure.mgmt.search.models.SearchResourceEncryptionKey": "Microsoft.Search.SearchResourceEncryptionKey", + "azure.mgmt.search.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.search.models.SearchService": "Microsoft.Search.SearchService", + "azure.mgmt.search.models.SearchServiceProperties": "Microsoft.Search.SearchServiceProperties", + "azure.mgmt.search.models.SearchServiceUpdate": "Microsoft.Search.SearchServiceUpdate", + "azure.mgmt.search.models.ShareablePrivateLinkResourceProperties": "Microsoft.Search.ShareablePrivateLinkResourceProperties", + "azure.mgmt.search.models.ShareablePrivateLinkResourceType": "Microsoft.Search.ShareablePrivateLinkResourceType", + "azure.mgmt.search.models.SharedPrivateLinkResource": "Microsoft.Search.SharedPrivateLinkResource", + "azure.mgmt.search.models.SharedPrivateLinkResourceProperties": "Microsoft.Search.SharedPrivateLinkResourceProperties", + "azure.mgmt.search.models.Sku": "Microsoft.Search.Sku", + "azure.mgmt.search.models.SkuLimits": "Microsoft.Search.SkuLimits", + "azure.mgmt.search.models.SkuOffering": "Microsoft.Search.SkuOffering", + "azure.mgmt.search.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.search.models.UserAssignedIdentity": "Azure.ResourceManager.CommonTypes.UserAssignedIdentity", + "azure.mgmt.search.models.SkuName": "Microsoft.Search.SkuName", + "azure.mgmt.search.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.search.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.search.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.search.models.PrivateLinkServiceConnectionStatus": "Microsoft.Search.PrivateLinkServiceConnectionStatus", + "azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState": "Microsoft.Search.PrivateLinkServiceConnectionProvisioningState", + "azure.mgmt.search.models.SharedPrivateLinkResourceStatus": "Microsoft.Search.SharedPrivateLinkResourceStatus", + "azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState": "Microsoft.Search.SharedPrivateLinkResourceProvisioningState", + "azure.mgmt.search.models.NetworkSecurityPerimeterConfigurationProvisioningState": "Azure.ResourceManager.CommonTypes.NetworkSecurityPerimeterConfigurationProvisioningState", + "azure.mgmt.search.models.IssueType": "Azure.ResourceManager.CommonTypes.IssueType", + "azure.mgmt.search.models.Severity": "Azure.ResourceManager.CommonTypes.Severity", + "azure.mgmt.search.models.AccessRuleDirection": "Azure.ResourceManager.CommonTypes.AccessRuleDirection", + "azure.mgmt.search.models.ResourceAssociationAccessMode": "Azure.ResourceManager.CommonTypes.ResourceAssociationAccessMode", + "azure.mgmt.search.models.UnavailableNameReason": "Microsoft.Search.UnavailableNameReason", + "azure.mgmt.search.models.HostingMode": "Microsoft.Search.HostingMode", + "azure.mgmt.search.models.ComputeType": "Microsoft.Search.ComputeType", + "azure.mgmt.search.models.PublicNetworkAccess": "Microsoft.Search.PublicNetworkAccess", + "azure.mgmt.search.models.SearchServiceStatus": "Microsoft.Search.SearchServiceStatus", + "azure.mgmt.search.models.ProvisioningState": "Microsoft.Search.ProvisioningState", + "azure.mgmt.search.models.SearchBypass": "Microsoft.Search.SearchBypass", + "azure.mgmt.search.models.SearchDataExfiltrationProtection": "Microsoft.Search.SearchDataExfiltrationProtection", + "azure.mgmt.search.models.SearchEncryptionWithCmk": "Microsoft.Search.SearchEncryptionWithCmk", + "azure.mgmt.search.models.SearchEncryptionComplianceStatus": "Microsoft.Search.SearchEncryptionComplianceStatus", + "azure.mgmt.search.models.AadAuthFailureMode": "Microsoft.Search.AadAuthFailureMode", + "azure.mgmt.search.models.SearchSemanticSearch": "Microsoft.Search.SearchSemanticSearch", + "azure.mgmt.search.models.KnowledgeRetrieval": "Microsoft.Search.KnowledgeRetrieval", + "azure.mgmt.search.models.UpgradeAvailable": "Microsoft.Search.UpgradeAvailable", + "azure.mgmt.search.models.IdentityType": "Microsoft.Search.IdentityType", + "azure.mgmt.search.models.AdminKeyKind": "Microsoft.Search.AdminKeyKind", + "azure.mgmt.search.operations.OfferingsOperations.list": "Microsoft.Search.Offerings.list", + "azure.mgmt.search.aio.operations.OfferingsOperations.list": "Microsoft.Search.Offerings.list", + "azure.mgmt.search.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.search.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.search.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.Search.PrivateEndpointConnections.get", + "azure.mgmt.search.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.Search.PrivateEndpointConnections.get", + "azure.mgmt.search.operations.PrivateEndpointConnectionsOperations.update": "Microsoft.Search.PrivateEndpointConnections.update", + "azure.mgmt.search.aio.operations.PrivateEndpointConnectionsOperations.update": "Microsoft.Search.PrivateEndpointConnections.update", + "azure.mgmt.search.operations.PrivateEndpointConnectionsOperations.delete": "Microsoft.Search.PrivateEndpointConnections.delete", + "azure.mgmt.search.aio.operations.PrivateEndpointConnectionsOperations.delete": "Microsoft.Search.PrivateEndpointConnections.delete", + "azure.mgmt.search.operations.PrivateEndpointConnectionsOperations.list_by_service": "Microsoft.Search.PrivateEndpointConnections.listByService", + "azure.mgmt.search.aio.operations.PrivateEndpointConnectionsOperations.list_by_service": "Microsoft.Search.PrivateEndpointConnections.listByService", + "azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations.get": "Microsoft.Search.SharedPrivateLinkResources.get", + "azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations.get": "Microsoft.Search.SharedPrivateLinkResources.get", + "azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations.begin_create_or_update": "Microsoft.Search.SharedPrivateLinkResources.createOrUpdate", + "azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations.begin_create_or_update": "Microsoft.Search.SharedPrivateLinkResources.createOrUpdate", + "azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations.begin_delete": "Microsoft.Search.SharedPrivateLinkResources.delete", + "azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations.begin_delete": "Microsoft.Search.SharedPrivateLinkResources.delete", + "azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations.list_by_service": "Microsoft.Search.SharedPrivateLinkResources.listByService", + "azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations.list_by_service": "Microsoft.Search.SharedPrivateLinkResources.listByService", + "azure.mgmt.search.operations.NetworkSecurityPerimeterConfigurationsOperations.get": "Microsoft.Search.NetworkSecurityPerimeterConfigurations.get", + "azure.mgmt.search.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.get": "Microsoft.Search.NetworkSecurityPerimeterConfigurations.get", + "azure.mgmt.search.operations.NetworkSecurityPerimeterConfigurationsOperations.list_by_service": "Microsoft.Search.NetworkSecurityPerimeterConfigurations.listByService", + "azure.mgmt.search.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.list_by_service": "Microsoft.Search.NetworkSecurityPerimeterConfigurations.listByService", + "azure.mgmt.search.operations.NetworkSecurityPerimeterConfigurationsOperations.begin_reconcile": "Microsoft.Search.NetworkSecurityPerimeterConfigurations.reconcile", + "azure.mgmt.search.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.begin_reconcile": "Microsoft.Search.NetworkSecurityPerimeterConfigurations.reconcile", + "azure.mgmt.search.operations.ServicesOperations.check_name_availability": "Microsoft.Search.ServicesOperationGroup.checkNameAvailability", + "azure.mgmt.search.aio.operations.ServicesOperations.check_name_availability": "Microsoft.Search.ServicesOperationGroup.checkNameAvailability", + "azure.mgmt.search.operations.ServicesOperations.get": "Microsoft.Search.SearchServices.get", + "azure.mgmt.search.aio.operations.ServicesOperations.get": "Microsoft.Search.SearchServices.get", + "azure.mgmt.search.operations.ServicesOperations.begin_create_or_update": "Microsoft.Search.SearchServices.createOrUpdate", + "azure.mgmt.search.aio.operations.ServicesOperations.begin_create_or_update": "Microsoft.Search.SearchServices.createOrUpdate", + "azure.mgmt.search.operations.ServicesOperations.update": "Microsoft.Search.SearchServices.update", + "azure.mgmt.search.aio.operations.ServicesOperations.update": "Microsoft.Search.SearchServices.update", + "azure.mgmt.search.operations.ServicesOperations.delete": "Microsoft.Search.SearchServices.delete", + "azure.mgmt.search.aio.operations.ServicesOperations.delete": "Microsoft.Search.SearchServices.delete", + "azure.mgmt.search.operations.ServicesOperations.list_by_resource_group": "Microsoft.Search.SearchServices.listByResourceGroup", + "azure.mgmt.search.aio.operations.ServicesOperations.list_by_resource_group": "Microsoft.Search.SearchServices.listByResourceGroup", + "azure.mgmt.search.operations.ServicesOperations.list_by_subscription": "Microsoft.Search.SearchServices.listBySubscription", + "azure.mgmt.search.aio.operations.ServicesOperations.list_by_subscription": "Microsoft.Search.SearchServices.listBySubscription", + "azure.mgmt.search.operations.ServicesOperations.begin_upgrade": "Microsoft.Search.SearchServices.upgrade", + "azure.mgmt.search.aio.operations.ServicesOperations.begin_upgrade": "Microsoft.Search.SearchServices.upgrade", + "azure.mgmt.search.operations.UsagesOperations.list_by_subscription": "Microsoft.Search.UsagesOperationGroup.listBySubscription", + "azure.mgmt.search.aio.operations.UsagesOperations.list_by_subscription": "Microsoft.Search.UsagesOperationGroup.listBySubscription", + "azure.mgmt.search.operations.AdminKeysOperations.get": "Microsoft.Search.SearchServices.adminKeysGet", + "azure.mgmt.search.aio.operations.AdminKeysOperations.get": "Microsoft.Search.SearchServices.adminKeysGet", + "azure.mgmt.search.operations.AdminKeysOperations.regenerate": "Microsoft.Search.SearchServices.regenerate", + "azure.mgmt.search.aio.operations.AdminKeysOperations.regenerate": "Microsoft.Search.SearchServices.regenerate", + "azure.mgmt.search.operations.QueryKeysOperations.create": "Microsoft.Search.SearchServices.create", + "azure.mgmt.search.aio.operations.QueryKeysOperations.create": "Microsoft.Search.SearchServices.create", + "azure.mgmt.search.operations.QueryKeysOperations.list_by_search_service": "Microsoft.Search.SearchServices.listBySearchService", + "azure.mgmt.search.aio.operations.QueryKeysOperations.list_by_search_service": "Microsoft.Search.SearchServices.listBySearchService", + "azure.mgmt.search.operations.QueryKeysOperations.delete": "Microsoft.Search.SearchServices.queryKeysDelete", + "azure.mgmt.search.aio.operations.QueryKeysOperations.delete": "Microsoft.Search.SearchServices.queryKeysDelete", + "azure.mgmt.search.operations.PrivateLinkResourcesOperations.list_supported": "Microsoft.Search.SearchServices.listSupported", + "azure.mgmt.search.aio.operations.PrivateLinkResourcesOperations.list_supported": "Microsoft.Search.SearchServices.listSupported", + "azure.mgmt.search.SearchManagementClient.usage_by_subscription_sku": "Microsoft.Search.usageBySubscriptionSku", + "azure.mgmt.search.aio.SearchManagementClient.usage_by_subscription_sku": "Microsoft.Search.usageBySubscriptionSku" + } +} \ No newline at end of file diff --git a/sdk/search/azure-mgmt-search/azure/__init__.py b/sdk/search/azure-mgmt-search/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/search/azure-mgmt-search/azure/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py index bed79077840d..682b20b05922 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._search_management_client import SearchManagementClient # type: ignore +from ._client import SearchManagementClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_client.py similarity index 75% rename from sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py rename to sdk/search/azure-mgmt-search/azure/mgmt/search/_client.py index ae44305e78cd..01e8c283676a 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,75 +17,93 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models from ._configuration import SearchManagementClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( AdminKeysOperations, NetworkSecurityPerimeterConfigurationsOperations, + OfferingsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueryKeysOperations, - SearchManagementClientOperationsMixin, ServicesOperations, SharedPrivateLinkResourcesOperations, UsagesOperations, + _SearchManagementClientOperationsMixin, ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class SearchManagementClient(SearchManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes - """Client that can be used to manage Azure AI Search services and API keys. +class SearchManagementClient(_SearchManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes + """SearchManagementClient. + :ivar offerings: OfferingsOperations operations + :vartype offerings: azure.mgmt.search.operations.OfferingsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.search.operations.Operations - :ivar admin_keys: AdminKeysOperations operations - :vartype admin_keys: azure.mgmt.search.operations.AdminKeysOperations - :ivar query_keys: QueryKeysOperations operations - :vartype query_keys: azure.mgmt.search.operations.QueryKeysOperations - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.search.operations.ServicesOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: azure.mgmt.search.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.search.operations.PrivateEndpointConnectionsOperations :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations :vartype shared_private_link_resources: azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations - :ivar usages: UsagesOperations operations - :vartype usages: azure.mgmt.search.operations.UsagesOperations :ivar network_security_perimeter_configurations: NetworkSecurityPerimeterConfigurationsOperations operations :vartype network_security_perimeter_configurations: azure.mgmt.search.operations.NetworkSecurityPerimeterConfigurationsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.search.operations.ServicesOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.search.operations.UsagesOperations + :ivar admin_keys: AdminKeysOperations operations + :vartype admin_keys: azure.mgmt.search.operations.AdminKeysOperations + :ivar query_keys: QueryKeysOperations operations + :vartype query_keys: azure.mgmt.search.operations.QueryKeysOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: azure.mgmt.search.operations.PrivateLinkResourcesOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are + "2026-03-01-preview". Default value is "2026-03-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoint = "{endpoint}" + _cloud = cloud_setting 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 = SearchManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -106,37 +124,37 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.offerings = OfferingsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.admin_keys = AdminKeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.query_keys = QueryKeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.admin_keys = AdminKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.query_keys = QueryKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -149,7 +167,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py index 72d2231f9c64..9d4e0c662453 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,6 +14,7 @@ from ._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -23,18 +24,30 @@ class SearchManagementClientConfiguration: # pylint: disable=too-many-instance- Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are + "2026-03-01-preview". Default value is "2026-03-01-preview". 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", "2025-05-01") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2026-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +56,8 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-search/{}".format(VERSION)) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_patch.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_patch.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/__init__.py @@ -1,6 +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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/model_base.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/model_base.py new file mode 100644 index 000000000000..7b7f8ba67b53 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/model_base.py @@ -0,0 +1,1350 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_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_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._is_optional = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/serialization.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/serialization.py index f5187701d7be..81ec1de5922b 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/serialization.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -21,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -31,7 +30,6 @@ Mapping, Callable, MutableMapping, - List, ) try: @@ -229,12 +227,12 @@ class Model: serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map: dict[str, dict[str, Any]] = {} + _attribute_map: dict[str, dict[str, Any]] = {} + _validation: dict[str, dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} 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__) @@ -311,7 +309,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,7 +378,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: def from_dict( cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, ) -> Self: """Parse a dict using given key extractor return a model. @@ -414,7 +412,7 @@ 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)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod @@ -528,7 +526,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -579,7 +577,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -789,7 +787,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -823,13 +821,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ 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 # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1184,7 +1189,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1386,7 +1391,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1759,7 +1764,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :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 or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1785,7 +1790,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/utils.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/utils.py index 39b612f39a9b..35c9c836f85f 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/utils.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_utils/utils.py @@ -1,7 +1,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_validation.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py index 6b357123854d..c36aac0dab1b 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py @@ -2,8 +2,8 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.2.0" +VERSION = "10.0.0b1" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py index bf513e736924..51a76cd0748c 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._search_management_client import SearchManagementClient # type: ignore +from ._client import SearchManagementClient # type: ignore try: from ._patch import __all__ as _patch_all diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_client.py similarity index 76% rename from sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py rename to sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_client.py index c4cbf77deddc..b0fd108882b4 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_search_management_client.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_client.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -17,76 +17,94 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer from ._configuration import SearchManagementClientConfiguration from .operations import ( AdminKeysOperations, NetworkSecurityPerimeterConfigurationsOperations, + OfferingsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueryKeysOperations, - SearchManagementClientOperationsMixin, ServicesOperations, SharedPrivateLinkResourcesOperations, UsagesOperations, + _SearchManagementClientOperationsMixin, ) if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class SearchManagementClient(SearchManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes - """Client that can be used to manage Azure AI Search services and API keys. +class SearchManagementClient(_SearchManagementClientOperationsMixin): # pylint: disable=too-many-instance-attributes + """SearchManagementClient. + :ivar offerings: OfferingsOperations operations + :vartype offerings: azure.mgmt.search.aio.operations.OfferingsOperations :ivar operations: Operations operations :vartype operations: azure.mgmt.search.aio.operations.Operations - :ivar admin_keys: AdminKeysOperations operations - :vartype admin_keys: azure.mgmt.search.aio.operations.AdminKeysOperations - :ivar query_keys: QueryKeysOperations operations - :vartype query_keys: azure.mgmt.search.aio.operations.QueryKeysOperations - :ivar services: ServicesOperations operations - :vartype services: azure.mgmt.search.aio.operations.ServicesOperations - :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: - azure.mgmt.search.aio.operations.PrivateLinkResourcesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.search.aio.operations.PrivateEndpointConnectionsOperations :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations :vartype shared_private_link_resources: azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations - :ivar usages: UsagesOperations operations - :vartype usages: azure.mgmt.search.aio.operations.UsagesOperations :ivar network_security_perimeter_configurations: NetworkSecurityPerimeterConfigurationsOperations operations :vartype network_security_perimeter_configurations: azure.mgmt.search.aio.operations.NetworkSecurityPerimeterConfigurationsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar services: ServicesOperations operations + :vartype services: azure.mgmt.search.aio.operations.ServicesOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.search.aio.operations.UsagesOperations + :ivar admin_keys: AdminKeysOperations operations + :vartype admin_keys: azure.mgmt.search.aio.operations.AdminKeysOperations + :ivar query_keys: QueryKeysOperations operations + :vartype query_keys: azure.mgmt.search.aio.operations.QueryKeysOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.search.aio.operations.PrivateLinkResourcesOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this - default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are + "2026-03-01-preview". Default value is "2026-03-01-preview". Note that overriding this default + value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoint = "{endpoint}" + _cloud = cloud_setting 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 = SearchManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -108,32 +126,32 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **kwargs ) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False + self.offerings = OfferingsOperations(self._client, self._config, self._serialize, self._deserialize) self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.admin_keys = AdminKeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.query_keys = QueryKeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.admin_keys = AdminKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.query_keys = QueryKeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -141,7 +159,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -154,7 +172,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py index 9602395c8d81..f4dd4d3f5987 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,6 +14,7 @@ from .._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -23,18 +24,30 @@ class SearchManagementClientConfiguration: # pylint: disable=too-many-instance- Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The unique identifier for a Microsoft Azure subscription. You can - obtain this value from the Azure Resource Manager API or the portal. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are + "2026-03-01-preview". Default value is "2026-03-01-preview". 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", "2025-05-01") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2026-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +56,8 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-search/{}".format(VERSION)) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_patch.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_patch.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py index 209140865c02..ef48e827d5f3 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/__init__.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,32 +12,33 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import +from ._operations import OfferingsOperations # type: ignore from ._operations import Operations # type: ignore -from ._admin_keys_operations import AdminKeysOperations # type: ignore -from ._query_keys_operations import QueryKeysOperations # type: ignore -from ._services_operations import ServicesOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations # type: ignore -from ._usages_operations import UsagesOperations # type: ignore -from ._search_management_client_operations import SearchManagementClientOperationsMixin # type: ignore -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import SharedPrivateLinkResourcesOperations # type: ignore +from ._operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import ServicesOperations # type: ignore +from ._operations import UsagesOperations # type: ignore +from ._operations import AdminKeysOperations # type: ignore +from ._operations import QueryKeysOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import _SearchManagementClientOperationsMixin # type: ignore # pylint: disable=unused-import from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "OfferingsOperations", "Operations", - "AdminKeysOperations", - "QueryKeysOperations", - "ServicesOperations", - "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", "SharedPrivateLinkResourcesOperations", - "UsagesOperations", - "SearchManagementClientOperationsMixin", "NetworkSecurityPerimeterConfigurationsOperations", + "ServicesOperations", + "UsagesOperations", + "AdminKeysOperations", + "QueryKeysOperations", + "PrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py deleted file mode 100644 index 2b4fa8abe6b6..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_admin_keys_operations.py +++ /dev/null @@ -1,204 +0,0 @@ -# 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 typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core import AsyncPipelineClient -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_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._admin_keys_operations import build_get_request, build_regenerate_request -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AdminKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.aio.SearchManagementClient`'s - :attr:`admin_keys` 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: SearchManagementClientConfiguration = 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, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.AdminKeyResult: - """Gets the primary and secondary admin API keys for the specified Azure AI Search service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: AdminKeyResult or the result of cls(response) - :rtype: ~azure.mgmt.search.models.AdminKeyResult - :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.AdminKeyResult] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AdminKeyResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def regenerate( - self, - resource_group_name: str, - search_service_name: str, - key_kind: Union[str, _models.AdminKeyKind], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.AdminKeyResult: - """Regenerates either the primary or secondary admin API key. You can only regenerate one key at a - time. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param key_kind: Specifies which key to regenerate. Valid values include 'primary' and - 'secondary'. Known values are: "primary" and "secondary". Required. - :type key_kind: str or ~azure.mgmt.search.models.AdminKeyKind - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: AdminKeyResult or the result of cls(response) - :rtype: ~azure.mgmt.search.models.AdminKeyResult - :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.AdminKeyResult] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_regenerate_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - key_kind=key_kind, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AdminKeyResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_network_security_perimeter_configurations_operations.py deleted file mode 100644 index dab6a2e554cc..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_network_security_perimeter_configurations_operations.py +++ /dev/null @@ -1,327 +0,0 @@ -# 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 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, - 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._network_security_perimeter_configurations_operations import ( - build_get_request, - build_list_by_service_request, - build_reconcile_request, -) -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.aio.SearchManagementClient`'s - :attr:`network_security_perimeter_configurations` 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: SearchManagementClientConfiguration = 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_by_service( - self, resource_group_name: str, search_service_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NetworkSecurityPerimeterConfiguration"]: - """Gets a list of network security perimeter configurations for a search service. - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration] - :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.NetworkSecurityPerimeterConfigurationListResult] = 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_by_service_request( - resource_group_name=resource_group_name, - search_service_name=search_service_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("NetworkSecurityPerimeterConfigurationListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any - ) -> _models.NetworkSecurityPerimeterConfiguration: - """Gets a network security perimeter configuration. - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param nsp_config_name: The network security perimeter configuration name. Required. - :type nsp_config_name: str - :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration - :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.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - nsp_config_name=nsp_config_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _reconcile_initial( - self, resource_group_name: str, search_service_name: str, nsp_config_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_reconcile_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - nsp_config_name=nsp_config_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]: - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_reconcile( - self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reconcile network security perimeter configuration for the Azure AI Search resource provider. - This triggers a manual resync with network security perimeter configurations by ensuring the - search service carries the latest configuration. - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param nsp_config_name: The network security perimeter configuration name. Required. - :type nsp_config_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._reconcile_initial( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - nsp_config_name=nsp_config_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 diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py index 7c24b344f658..61543ee8e5ce 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_operations.py @@ -1,12 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -17,21 +20,149 @@ 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.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request +from ..._utils.utils import ClientMixinABC +from ..._validation import api_version_validation +from ...operations._operations import ( + build_admin_keys_get_request, + build_admin_keys_regenerate_request, + build_network_security_perimeter_configurations_get_request, + build_network_security_perimeter_configurations_list_by_service_request, + build_network_security_perimeter_configurations_reconcile_request, + build_offerings_list_request, + build_operations_list_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_by_service_request, + build_private_endpoint_connections_update_request, + build_private_link_resources_list_supported_request, + build_query_keys_create_request, + build_query_keys_delete_request, + build_query_keys_list_by_search_service_request, + build_search_management_usage_by_subscription_sku_request, + build_services_check_name_availability_request, + build_services_create_or_update_request, + build_services_delete_request, + build_services_get_request, + build_services_list_by_resource_group_request, + build_services_list_by_subscription_request, + build_services_update_request, + build_services_upgrade_request, + build_shared_private_link_resources_create_or_update_request, + build_shared_private_link_resources_delete_request, + build_shared_private_link_resources_get_request, + build_shared_private_link_resources_list_by_service_request, + build_usages_list_by_subscription_request, +) from .._configuration import SearchManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] +List = list + + +class OfferingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`offerings` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-03-01-preview", + params_added_on={"2026-03-01-preview": ["api_version", "accept"]}, + api_versions_list=["2026-03-01-preview"], + ) + async def list(self, **kwargs: Any) -> _models.OfferingsListResult: + """Lists all of the features and SKUs offered by the Azure AI Search service in each region. Note: + This API returns a non-ARM resource collection and is not RPC-compliant. It will be replaced + with an action-style API in the next preview as a breaking change. Customers should avoid + taking new dependencies on the current shape. + + :return: OfferingsListResult. The OfferingsListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.OfferingsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OfferingsListResult] = kwargs.pop("cls", None) + + _request = build_offerings_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OfferingsListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore class Operations: @@ -44,8 +175,6 @@ class Operations: :attr:`operations` 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") @@ -54,18 +183,495 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: """Lists all of the available REST API operations of the Microsoft.Search provider. - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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, resource_group_name: str, search_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the details of the private endpoint connection to the search service in the given resource + group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. Required. + :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. Required. + :type private_endpoint_connection: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. Required. + :type private_endpoint_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: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. Is one of the following types: PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection or JSON + or IO[bytes] + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection + else: + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete( + self, resource_group_name: str, search_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Optional[_models.PrivateEndpointConnection]: + """Disconnects the private endpoint connection and deletes it from the search service. Returns 200 + (OK) with the deleted connection details on successful deletion, or 404 (Not Found) if the + connection does not exist. NOTE: The behavior of returning 404 is inconsistent with ARM + guidelines. Clients should expect a 204 response in future versions and avoid new dependencies + on the 404 response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or None. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = 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, 404]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_service( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """Gets a list of all private endpoint connections in the given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -78,12 +684,20 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_private_endpoint_connections_list_by_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -98,16 +712,24 @@ def prepare_request(next_link=None): _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" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -120,8 +742,2697 @@ async def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + +class SharedPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`shared_private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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, resource_group_name: str, search_service_name: str, shared_private_link_resource_name: str, **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Gets the details of the shared private link resource managed by the search service in the given + resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :return: SharedPrivateLinkResource. The SharedPrivateLinkResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_shared_private_link_resources_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SharedPrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(shared_private_link_resource, (IOBase, bytes)): + _content = shared_private_link_resource + else: + _content = json.dumps(shared_private_link_resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_shared_private_link_resources_create_or_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: _models.SharedPrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource + :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 SharedPrivateLinkResource. The + SharedPrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SharedPrivateLinkResource. The + SharedPrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SharedPrivateLinkResource. The + SharedPrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Is one of the following types: SharedPrivateLinkResource, JSON, IO[bytes] + Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns SharedPrivateLinkResource. The + SharedPrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedPrivateLinkResource] = 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, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + shared_private_link_resource=shared_private_link_resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SharedPrivateLinkResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SharedPrivateLinkResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SharedPrivateLinkResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, search_service_name: str, shared_private_link_resource_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_shared_private_link_resources_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 404]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, search_service_name: str, shared_private_link_resource_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Initiates the deletion of the shared private link resource from the search service. Returns 202 + (Accepted) for asynchronous deletion, 204 (No Content) if the service exists but the shared + private link is not found, or 404 (Not Found) if the service is not found. NOTE: The behavior + of returning 404 is inconsistent with ARM guidelines. Clients should expect a 204 response in + future versions and avoid new dependencies on the 404 response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_service( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SharedPrivateLinkResource"]: + """Gets a list of all shared private link resources managed by the given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of SharedPrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedPrivateLinkResource]] = 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_shared_private_link_resources_list_by_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SharedPrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`network_security_perimeter_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets a network security perimeter configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param nsp_config_name: The network security perimeter configuration name. Required. + :type nsp_config_name: str + :return: NetworkSecurityPerimeterConfiguration. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + nsp_config_name=nsp_config_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_service( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.NetworkSecurityPerimeterConfiguration"]: + """Gets a list of network security perimeter configurations for a search service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = 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_network_security_perimeter_configurations_list_by_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NetworkSecurityPerimeterConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _reconcile_initial( + self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_reconcile_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + nsp_config_name=nsp_config_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reconcile( + self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reconcile network security perimeter configuration for the Azure AI Search resource provider. + This triggers a manual resync with network security perimeter configurations by ensuring the + search service carries the latest configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param nsp_config_name: The network security perimeter configuration name. Required. + :type nsp_config_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._reconcile_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + nsp_config_name=nsp_config_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def check_name_availability( + self, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://.search.windows.net). + + :param check_name_availability_input: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.search.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, check_name_availability_input: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://.search.windows.net). + + :param check_name_availability_input: The request body. Required. + :type check_name_availability_input: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://.search.windows.net). + + :param check_name_availability_input: The request body. Required. + :type check_name_availability_input: 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: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://.search.windows.net). + + :param check_name_availability_input: The request body. Is one of the following types: + CheckNameAvailabilityInput, JSON, IO[bytes] Required. + :type check_name_availability_input: ~azure.mgmt.search.models.CheckNameAvailabilityInput or + JSON or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_services_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get(self, resource_group_name: str, search_service_name: str, **kwargs: Any) -> _models.SearchService: + """Gets the search service with the given name in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) + + _request = build_services_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SearchService, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + service: Union[_models.SearchService, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(service, (IOBase, bytes)): + _content = service + else: + _content = json.dumps(service, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_services_create_or_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: _models.SearchService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SearchService]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to create or update. Create applies to + both serverless and dedicated search services; update applies only to dedicated search + services. Required. + :type service: ~azure.mgmt.search.models.SearchService + :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 SearchService. The SearchService is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SearchService]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to create or update. Create applies to + both serverless and dedicated search services; update applies only to dedicated search + services. Required. + :type service: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SearchService. The SearchService is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SearchService]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to create or update. Create applies to + both serverless and dedicated search services; update applies only to dedicated search + services. Required. + :type service: 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 SearchService. The SearchService is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: Union[_models.SearchService, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SearchService]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to create or update. Create applies to + both serverless and dedicated search services; update applies only to dedicated search + services. Is one of the following types: SearchService, JSON, IO[bytes] Required. + :type service: ~azure.mgmt.search.models.SearchService or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns SearchService. The SearchService is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = 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, + search_service_name=search_service_name, + service=service, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SearchService, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SearchService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SearchService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + search_service_name: str, + service: _models.SearchServiceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SearchService: + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to update. Required. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + search_service_name: str, + service: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SearchService: + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to update. Required. + :type service: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + search_service_name: str, + service: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SearchService: + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to update. Required. + :type service: 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: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + search_service_name: str, + service: Union[_models.SearchServiceUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SearchService: + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to update. Is one of the following types: + SearchServiceUpdate, JSON, IO[bytes] Required. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate or JSON or IO[bytes] + :return: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(service, (IOBase, bytes)): + _content = service + else: + _content = json.dumps(service, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_services_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SearchService, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, resource_group_name: str, search_service_name: str, **kwargs: Any) -> None: + """Deletes a search service in the given resource group, along with its associated resources. + Returns 200 (OK) on successful deletion, or 204 (No Content) if the service is not found. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_services_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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 = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.SearchService"]: + """Gets a list of all search services in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of SearchService + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SearchService]] = 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_services_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SearchService], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.SearchService"]: + """Gets a list of all search services in the given subscription. + + :return: An iterator like instance of SearchService + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SearchService]] = 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_services_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SearchService], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _upgrade_initial( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_services_upgrade_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_upgrade( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.SearchService]: + """Upgrades the Azure AI Search service to the latest version available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An instance of AsyncLROPoller that returns SearchService. The SearchService is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SearchService] = 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._upgrade_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.SearchService, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SearchService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SearchService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`usages` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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_by_subscription(self, location: str, **kwargs: Any) -> AsyncItemPaged["_models.QuotaUsageResult"]: + """Get a list of all Azure AI Search quota usages across the subscription. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of QuotaUsageResult + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.QuotaUsageResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.QuotaUsageResult]] = 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_usages_list_by_subscription_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.QuotaUsageResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class AdminKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`admin_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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, resource_group_name: str, search_service_name: str, **kwargs: Any) -> _models.AdminKeyResult: + """Gets the primary and secondary admin API keys for the specified Azure AI Search service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: AdminKeyResult. The AdminKeyResult is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.AdminKeyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) + + _request = build_admin_keys_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AdminKeyResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def regenerate( + self, + resource_group_name: str, + search_service_name: str, + key_kind: Union[str, _models.AdminKeyKind], + **kwargs: Any + ) -> _models.AdminKeyResult: + """Regenerates either the primary or secondary admin API key. You can only regenerate one key at a + time. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param key_kind: Specifies which key to regenerate. Valid values include 'primary' and + 'secondary'. Known values are: "primary" and "secondary". Required. + :type key_kind: str or ~azure.mgmt.search.models.AdminKeyKind + :return: AdminKeyResult. The AdminKeyResult is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.AdminKeyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) + + _request = build_admin_keys_regenerate_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + key_kind=key_kind, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AdminKeyResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class QueryKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`query_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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 create( + self, resource_group_name: str, search_service_name: str, name: str, **kwargs: Any + ) -> _models.QueryKey: + """Generates a new query key for the specified search service. You can create up to 50 query keys + per service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param name: The name of the new query API key. Required. + :type name: str + :return: QueryKey. The QueryKey is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.QueryKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.QueryKey] = kwargs.pop("cls", None) + + _request = build_query_keys_create_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.QueryKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_search_service( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.QueryKey"]: + """Returns the list of query API keys for the given Azure AI Search service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of QueryKey + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.QueryKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.QueryKey]] = 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_query_keys_list_by_search_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.QueryKey], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace_async + async def delete(self, resource_group_name: str, search_service_name: str, key: str, **kwargs: Any) -> None: + """Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process + for regenerating a query key is to delete and then recreate it. Returns 200 (OK) on successful + deletion, 204 (No Content) if the service exists but the query keys not found, or 404 (Not + Found) if the service is not found. NOTE: The behavior of returning 404 is inconsistent with + ARM guidelines. Clients should expect a 204 response in future versions and avoid new + dependencies on the 404 response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param key: The query key to be deleted. Query keys are identified by value, not by name. + Required. + :type key: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_keys_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + key=key, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = 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, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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_supported( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateLinkResource"]: + """Gets a list of all supported private link resource types for the given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = 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_private_link_resources_list_supported_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class _SearchManagementClientOperationsMixin( + ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], SearchManagementClientConfiguration] +): + + @distributed_trace_async + async def usage_by_subscription_sku(self, location: str, sku_name: str, **kwargs: Any) -> _models.QuotaUsageResult: + """Gets the quota usage for a search SKU in the given subscription. + + :param location: The name of the Azure region. Required. + :type location: str + :param sku_name: The unique SKU name that identifies a billable tier. Required. + :type sku_name: str + :return: QuotaUsageResult. The QuotaUsageResult is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.QuotaUsageResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.QuotaUsageResult] = kwargs.pop("cls", None) + + _request = build_search_management_usage_by_subscription_sku_request( + location=location, + sku_name=sku_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.QuotaUsageResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_patch.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_patch.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index b037f5715300..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,494 +0,0 @@ -# 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._private_endpoint_connections_operations import ( - build_delete_request, - build_get_request, - build_list_by_service_request, - build_update_request, -) -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.aio.SearchManagementClient`'s - :attr:`private_endpoint_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: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def update( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The definition of the private endpoint connection to - update. Required. - :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The definition of the private endpoint connection to - update. Required. - :type private_endpoint_connection: IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The definition of the private endpoint connection to - update. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection or - IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_update_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets the details of the private endpoint connection to the search service in the given resource - group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = 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.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: - """Disconnects the private endpoint connection and deletes it from the search service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: PrivateEndpointConnection or None or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection or 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[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_delete_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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, 404]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_service( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """Gets a list of all private endpoint connections in the given service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.PrivateEndpointConnection] - :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.PrivateEndpointConnectionListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_service_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("PrivateEndpointConnectionListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index b185040809e2..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,152 +0,0 @@ -# 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 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, - 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.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._private_link_resources_operations import build_list_supported_request -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.aio.SearchManagementClient`'s - :attr:`private_link_resources` 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: SearchManagementClientConfiguration = 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_supported( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncIterable["_models.PrivateLinkResource"]: - """Gets a list of all supported private link resource types for the given service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.PrivateLinkResource] - :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.PrivateLinkResourcesResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_supported_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("PrivateLinkResourcesResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py deleted file mode 100644 index fcbd946f4851..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_query_keys_operations.py +++ /dev/null @@ -1,310 +0,0 @@ -# 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 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, - 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._query_keys_operations import ( - build_create_request, - build_delete_request, - build_list_by_search_service_request, -) -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class QueryKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.aio.SearchManagementClient`'s - :attr:`query_keys` 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: SearchManagementClientConfiguration = 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 create( - self, - resource_group_name: str, - search_service_name: str, - name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.QueryKey: - """Generates a new query key for the specified search service. You can create up to 50 query keys - per service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param name: The name of the new query API key. Required. - :type name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: QueryKey or the result of cls(response) - :rtype: ~azure.mgmt.search.models.QueryKey - :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.QueryKey] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_create_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - name=name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("QueryKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_search_service( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncIterable["_models.QueryKey"]: - """Returns the list of query API keys for the given Azure AI Search service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either QueryKey or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.QueryKey] - :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.ListQueryKeysResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_search_service_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("ListQueryKeysResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - search_service_name: str, - key: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> None: - """Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process - for regenerating a query key is to delete and then recreate it. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param key: The query key to be deleted. Query keys are identified by value, not by name. - Required. - :type key: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_delete_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - key=key, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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, 404]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_search_management_client_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_search_management_client_operations.py deleted file mode 100644 index 1216f000f628..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_search_management_client_operations.py +++ /dev/null @@ -1,107 +0,0 @@ -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core import AsyncPipelineClient -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_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.utils import ClientMixinABC -from ...operations._search_management_client_operations import build_usage_by_subscription_sku_request -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SearchManagementClientOperationsMixin(ClientMixinABC[AsyncPipelineClient, SearchManagementClientConfiguration]): - - @distributed_trace_async - async def usage_by_subscription_sku( - self, - location: str, - sku_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.QuotaUsageResult: - """Gets the quota usage for a search SKU in the given subscription. - - .. seealso:: - - https://aka.ms/search-manage - - :param location: The unique location name for a Microsoft Azure geographic region. Required. - :type location: str - :param sku_name: The unique SKU name that identifies a billable tier. Required. - :type sku_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: QuotaUsageResult or the result of cls(response) - :rtype: ~azure.mgmt.search.models.QuotaUsageResult - :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.QuotaUsageResult] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_usage_by_subscription_sku_request( - location=location, - sku_name=sku_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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( # type: ignore # 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("QuotaUsageResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py deleted file mode 100644 index e5d6ae3c0b10..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_services_operations.py +++ /dev/null @@ -1,988 +0,0 @@ -# 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, - Literal, - 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._services_operations import ( - build_check_name_availability_request, - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, - build_upgrade_request, -) -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.aio.SearchManagementClient`'s - :attr:`services` 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: SearchManagementClientConfiguration = 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_or_update_initial( - self, - resource_group_name: str, - search_service_name: str, - service: Union[_models.SearchService, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(service, (IOBase, bytes)): - _content = service - else: - _json = self._serialize.body(service, "SearchService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, 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_or_update( - self, - resource_group_name: str, - search_service_name: str, - service: _models.SearchService, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a search service in the given resource group. If the search service already - exists, all properties will be updated with the given values. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to create or update. Search - service names must only contain lowercase letters, digits or dashes, cannot use dash as the - first two or last one characters, cannot contain consecutive dashes, and must be between 2 and - 60 characters in length. Search service names must be unique since they are part of the service - URI (https://\\ :code:``.search.windows.net). You cannot change the service name after - the service is created. Required. - :type search_service_name: str - :param service: The definition of the search service to create or update. Required. - :type service: ~azure.mgmt.search.models.SearchService - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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 SearchService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - search_service_name: str, - service: IO[bytes], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a search service in the given resource group. If the search service already - exists, all properties will be updated with the given values. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to create or update. Search - service names must only contain lowercase letters, digits or dashes, cannot use dash as the - first two or last one characters, cannot contain consecutive dashes, and must be between 2 and - 60 characters in length. Search service names must be unique since they are part of the service - URI (https://\\ :code:``.search.windows.net). You cannot change the service name after - the service is created. Required. - :type search_service_name: str - :param service: The definition of the search service to create or update. Required. - :type service: IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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 SearchService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - search_service_name: str, - service: Union[_models.SearchService, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a search service in the given resource group. If the search service already - exists, all properties will be updated with the given values. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to create or update. Search - service names must only contain lowercase letters, digits or dashes, cannot use dash as the - first two or last one characters, cannot contain consecutive dashes, and must be between 2 and - 60 characters in length. Search service names must be unique since they are part of the service - URI (https://\\ :code:``.search.windows.net). You cannot change the service name after - the service is created. Required. - :type search_service_name: str - :param service: The definition of the search service to create or update. Is either a - SearchService type or a IO[bytes] type. Required. - :type service: ~azure.mgmt.search.models.SearchService or IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An instance of AsyncLROPoller that returns either SearchService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] - :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.SearchService] = 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, - search_service_name=search_service_name, - service=service, - search_management_request_options=search_management_request_options, - 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("SearchService", 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.SearchService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SearchService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - search_service_name: str, - service: _models.SearchServiceUpdate, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SearchService: - """Updates an existing search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to update. Required. - :type search_service_name: str - :param service: The definition of the search service to update. Required. - :type service: ~azure.mgmt.search.models.SearchServiceUpdate - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SearchService or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SearchService - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - search_service_name: str, - service: IO[bytes], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SearchService: - """Updates an existing search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to update. Required. - :type search_service_name: str - :param service: The definition of the search service to update. Required. - :type service: IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SearchService or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SearchService - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - search_service_name: str, - service: Union[_models.SearchServiceUpdate, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.SearchService: - """Updates an existing search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to update. Required. - :type search_service_name: str - :param service: The definition of the search service to update. Is either a SearchServiceUpdate - type or a IO[bytes] type. Required. - :type service: ~azure.mgmt.search.models.SearchServiceUpdate or IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: SearchService or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SearchService - :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.SearchService] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(service, (IOBase, bytes)): - _content = service - else: - _json = self._serialize.body(service, "SearchServiceUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SearchService", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.SearchService: - """Gets the search service with the given name in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: SearchService or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SearchService - :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.SearchService] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SearchService", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> None: - """Deletes a search service in the given resource group, along with its associated resources. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_delete_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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, 404]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SearchService"]: - """Gets a list of all Search services in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either SearchService or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SearchService] - :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.SearchServiceListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("SearchServiceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription( - self, search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> AsyncIterable["_models.SearchService"]: - """Gets a list of all Search services in the given subscription. - - .. seealso:: - - https://aka.ms/search-manage - - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either SearchService or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SearchService] - :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.SearchServiceListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("SearchServiceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def check_name_availability( - self, - name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.CheckNameAvailabilityOutput: - """Checks whether or not the given search service name is available for use. Search service names - must be globally unique since they are part of the service URI (https://\\ - :code:``.search.windows.net). - - .. seealso:: - - https://aka.ms/search-manage - - :param name: The search service name to validate. Search service names must only contain - lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, - cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. - :type name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput - :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - type: Literal["searchServices"] = kwargs.pop("type", "searchServices") - cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - _check_name_availability_input = _models.CheckNameAvailabilityInput(name=name, type=type) - _json = self._serialize.body(_check_name_availability_input, "CheckNameAvailabilityInput") - - _request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - client_request_id=_client_request_id, - api_version=api_version, - content_type=content_type, - json=_json, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _upgrade_initial( - self, resource_group_name: str, search_service_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_upgrade_request( - resource_group_name=resource_group_name, - search_service_name=search_service_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_upgrade( - self, resource_group_name: str, search_service_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.SearchService]: - """Upgrades the Azure AI Search service to the latest version available. - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :return: An instance of AsyncLROPoller that returns either SearchService or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SearchService] - :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.SearchService] = 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._upgrade_initial( - resource_group_name=resource_group_name, - search_service_name=search_service_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): - deserialized = self._deserialize("SearchService", 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": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.SearchService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SearchService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py deleted file mode 100644 index ce0fd528e5d0..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py +++ /dev/null @@ -1,626 +0,0 @@ -# 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._shared_private_link_resources_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_service_request, -) -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SharedPrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.aio.SearchManagementClient`'s - :attr:`shared_private_link_resources` 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: SearchManagementClientConfiguration = 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_or_update_initial( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(shared_private_link_resource, (IOBase, bytes)): - _content = shared_private_link_resource - else: - _json = self._serialize.body(shared_private_link_resource, "SharedPrivateLinkResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, 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_or_update( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - shared_private_link_resource: _models.SharedPrivateLinkResource, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: - """Initiates the creation or update of a shared private link resource managed by the search - service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param shared_private_link_resource: The definition of the shared private link resource to - create or update. Required. - :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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 SharedPrivateLinkResource or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - shared_private_link_resource: IO[bytes], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: - """Initiates the creation or update of a shared private link resource managed by the search - service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param shared_private_link_resource: The definition of the shared private link resource to - create or update. Required. - :type shared_private_link_resource: IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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 SharedPrivateLinkResource or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: - """Initiates the creation or update of a shared private link resource managed by the search - service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param shared_private_link_resource: The definition of the shared private link resource to - create or update. Is either a SharedPrivateLinkResource type or a IO[bytes] type. Required. - :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource or - IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An instance of AsyncLROPoller that returns either SharedPrivateLinkResource or the - result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] - :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.SharedPrivateLinkResource] = 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, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - shared_private_link_resource=shared_private_link_resource, - search_management_request_options=search_management_request_options, - 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("SharedPrivateLinkResource", 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": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.SharedPrivateLinkResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SharedPrivateLinkResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.SharedPrivateLinkResource: - """Gets the details of the shared private link resource managed by the search service in the given - resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: SharedPrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource - :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.SharedPrivateLinkResource] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_delete_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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, 404]: - 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) - raise HttpResponseError(response=response, 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, - search_service_name: str, - shared_private_link_resource_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Initiates the deletion of the shared private link resource from the search service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - search_management_request_options=search_management_request_options, - 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": "azure-async-operation"}, **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 - def list_by_service( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncIterable["_models.SharedPrivateLinkResource"]: - """Gets a list of all shared private link resources managed by the given service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either SharedPrivateLinkResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResource] - :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.SharedPrivateLinkResourceListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_service_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("SharedPrivateLinkResourceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_usages_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_usages_operations.py deleted file mode 100644 index 9ceefa32c836..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_usages_operations.py +++ /dev/null @@ -1,146 +0,0 @@ -# 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 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, - 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.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._usages_operations import build_list_by_subscription_request -from .._configuration import SearchManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class UsagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.aio.SearchManagementClient`'s - :attr:`usages` 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: SearchManagementClientConfiguration = 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_by_subscription( - self, - location: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> AsyncIterable["_models.QuotaUsageResult"]: - """Get a list of all Azure AI Search quota usages across the subscription. - - .. seealso:: - - https://aka.ms/search-manage - - :param location: The unique location name for a Microsoft Azure geographic region. Required. - :type location: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either QuotaUsageResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.QuotaUsageResult] - :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.QuotaUsagesListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_subscription_request( - location=location, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("QuotaUsagesListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py index 646e55d99331..68fd69620d66 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,63 +13,65 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore AccessRule, AccessRuleProperties, AccessRulePropertiesSubscriptionsItem, AdminKeyResult, - AsyncOperationResult, + AzureActiveDirectoryApplicationCredentials, CheckNameAvailabilityInput, CheckNameAvailabilityOutput, + CloudError, CloudErrorBody, + DataIdentity, + DataNoneIdentity, DataPlaneAadOrApiKeyAuthOption, DataPlaneAuthOptions, + DataUserAssignedIdentity, EncryptionWithCmk, + FeatureOffering, Identity, IpRule, - ListQueryKeysResult, NetworkRuleSet, NetworkSecurityPerimeter, NetworkSecurityPerimeterConfiguration, - NetworkSecurityPerimeterConfigurationListResult, NetworkSecurityPerimeterConfigurationProperties, NetworkSecurityProfile, + OfferingsByRegion, + OfferingsListResult, Operation, OperationDisplay, - OperationListResult, PrivateEndpointConnection, - PrivateEndpointConnectionListResult, PrivateEndpointConnectionProperties, PrivateEndpointConnectionPropertiesPrivateEndpoint, PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState, PrivateLinkResource, PrivateLinkResourceProperties, - PrivateLinkResourcesResult, ProvisioningIssue, ProvisioningIssueProperties, ProxyResource, QueryKey, QuotaUsageResult, QuotaUsageResultName, - QuotaUsagesListResult, Resource, ResourceAssociation, - SearchManagementRequestOptions, + SearchResourceEncryptionKey, SearchService, - SearchServiceListResult, + SearchServiceProperties, SearchServiceUpdate, ShareablePrivateLinkResourceProperties, ShareablePrivateLinkResourceType, SharedPrivateLinkResource, - SharedPrivateLinkResourceListResult, SharedPrivateLinkResourceProperties, Sku, + SkuLimits, + SkuOffering, SystemData, TrackedResource, UserAssignedIdentity, ) -from ._search_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore AadAuthFailureMode, AccessRuleDirection, ActionType, @@ -79,6 +81,7 @@ HostingMode, IdentityType, IssueType, + KnowledgeRetrieval, NetworkSecurityPerimeterConfigurationProvisioningState, Origin, PrivateLinkServiceConnectionProvisioningState, @@ -93,7 +96,6 @@ SearchSemanticSearch, SearchServiceStatus, Severity, - SharedPrivateLinkResourceAsyncOperationResult, SharedPrivateLinkResourceProvisioningState, SharedPrivateLinkResourceStatus, SkuName, @@ -109,52 +111,54 @@ "AccessRuleProperties", "AccessRulePropertiesSubscriptionsItem", "AdminKeyResult", - "AsyncOperationResult", + "AzureActiveDirectoryApplicationCredentials", "CheckNameAvailabilityInput", "CheckNameAvailabilityOutput", + "CloudError", "CloudErrorBody", + "DataIdentity", + "DataNoneIdentity", "DataPlaneAadOrApiKeyAuthOption", "DataPlaneAuthOptions", + "DataUserAssignedIdentity", "EncryptionWithCmk", + "FeatureOffering", "Identity", "IpRule", - "ListQueryKeysResult", "NetworkRuleSet", "NetworkSecurityPerimeter", "NetworkSecurityPerimeterConfiguration", - "NetworkSecurityPerimeterConfigurationListResult", "NetworkSecurityPerimeterConfigurationProperties", "NetworkSecurityProfile", + "OfferingsByRegion", + "OfferingsListResult", "Operation", "OperationDisplay", - "OperationListResult", "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", "PrivateEndpointConnectionProperties", "PrivateEndpointConnectionPropertiesPrivateEndpoint", "PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState", "PrivateLinkResource", "PrivateLinkResourceProperties", - "PrivateLinkResourcesResult", "ProvisioningIssue", "ProvisioningIssueProperties", "ProxyResource", "QueryKey", "QuotaUsageResult", "QuotaUsageResultName", - "QuotaUsagesListResult", "Resource", "ResourceAssociation", - "SearchManagementRequestOptions", + "SearchResourceEncryptionKey", "SearchService", - "SearchServiceListResult", + "SearchServiceProperties", "SearchServiceUpdate", "ShareablePrivateLinkResourceProperties", "ShareablePrivateLinkResourceType", "SharedPrivateLinkResource", - "SharedPrivateLinkResourceListResult", "SharedPrivateLinkResourceProperties", "Sku", + "SkuLimits", + "SkuOffering", "SystemData", "TrackedResource", "UserAssignedIdentity", @@ -167,6 +171,7 @@ "HostingMode", "IdentityType", "IssueType", + "KnowledgeRetrieval", "NetworkSecurityPerimeterConfigurationProvisioningState", "Origin", "PrivateLinkServiceConnectionProvisioningState", @@ -181,7 +186,6 @@ "SearchSemanticSearch", "SearchServiceStatus", "Severity", - "SharedPrivateLinkResourceAsyncOperationResult", "SharedPrivateLinkResourceProvisioningState", "SharedPrivateLinkResourceStatus", "SkuName", diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_enums.py similarity index 81% rename from sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py rename to sdk/search/azure-mgmt-search/azure/mgmt/search/models/_enums.py index fd0dcf43540b..7ae5372c1561 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_search_management_client_enums.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -29,17 +29,20 @@ class AccessRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): INBOUND = "Inbound" """Applies to inbound network traffic to the secured resources.""" OUTBOUND = "Outbound" - """Applies to outbound network traffic from the secured resources""" + """Applies to outbound network traffic from the secured resources.""" class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ INTERNAL = "Internal" + """Actions are for internal-only APIs.""" class AdminKeyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """AdminKeyKind.""" + """Type of AdminKeyKind.""" PRIMARY = "primary" """The primary API key for the search service.""" @@ -52,32 +55,36 @@ class ComputeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): Confidential Compute. """ - DEFAULT = "default" + DEFAULT = "Default" """Create the service with the Default Compute.""" - CONFIDENTIAL = "confidential" - """Create the service with Azure Confidential Compute.""" + CONFIDENTIAL = "Confidential" + """Create the dedicated service with Azure Confidential Compute.""" class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class HostingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed - for any other SKU. For the standard3 SKU, the value is either 'default' or 'highDensity'. For - all other SKUs, this value must be 'default'. + for any other SKU. For the standard3 SKU, the value is either 'Default' or 'HighDensity'. For + all other SKUs, this value must be 'Default'. """ - DEFAULT = "default" - """The limit on number of indexes is determined by the default limits for the SKU.""" - HIGH_DENSITY = "highDensity" - """Only application for standard3 SKU, where the search service can have up to 1000 indexes.""" + DEFAULT = "Default" + """The maximum limit of indexes is determined by the SKU or pricing tier.""" + HIGH_DENSITY = "HighDensity" + """Only applies to the Standard3 (S3) SKU, where the search services can have up to 1,000 indexes.""" class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -101,7 +108,7 @@ class IssueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Type of issue.""" UNKNOWN = "Unknown" - """Unknown issue type""" + """Unknown issue type.""" CONFIGURATION_PROPAGATION_FAILURE = "ConfigurationPropagationFailure" """An error occurred while applying the network security perimeter (NSP) configuration.""" MISSING_PERIMETER_CONFIGURATION = "MissingPerimeterConfiguration" @@ -113,18 +120,41 @@ class IssueType(str, Enum, metaclass=CaseInsensitiveEnumMeta): access rules, but it won't be able to perform outbound access as a member of the NSP.""" -class NetworkSecurityPerimeterConfigurationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class KnowledgeRetrieval(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the billing plan for agentic retrieval on the Azure AI Search service. This + configuration is only available for certain pricing tiers in certain regions. + """ + + FREE = "free" + """Enables knowledge retrieval on a search service and indicates that it is to be used within the + limits of the free plan. The free plan would cap the volume of knowledge retrieval requests and + is offered at no extra charge.""" + STANDARD = "standard" + """Enables knowledge retrieval on a search service as a billable feature after the free quota is + exhausted, with higher throughput and volume of knowledge retrieval requests.""" + + +class NetworkSecurityPerimeterConfigurationProvisioningState( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """Provisioning state of a network security perimeter configuration that is being created or updated. """ SUCCEEDED = "Succeeded" + """SUCCEEDED.""" CREATING = "Creating" + """CREATING.""" UPDATING = "Updating" + """UPDATING.""" DELETING = "Deleting" + """DELETING.""" ACCEPTED = "Accepted" + """ACCEPTED.""" FAILED = "Failed" + """FAILED.""" CANCELED = "Canceled" + """CANCELED.""" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -133,11 +163,16 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ USER = "user" + """Indicates the operation is initiated by a user.""" SYSTEM = "system" + """Indicates the operation is initiated by a system.""" USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" -class PrivateLinkServiceConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class PrivateLinkServiceConnectionProvisioningState( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The provisioning state of the private link service connection. Valid values are Updating, Deleting, Failed, Succeeded, Incomplete, or Canceled. """ @@ -186,23 +221,24 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): SUCCEEDED = "succeeded" """The last provisioning operation has completed successfully.""" PROVISIONING = "provisioning" - """The search service is being provisioned or scaled up or down.""" + """The search service is being provisioned or scaled up or down. For dedicated search services + only.""" FAILED = "failed" """The last provisioning operation has failed.""" class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This value can be set to 'enabled' to avoid breaking changes on existing customer resources and - templates. If set to 'disabled', traffic over public interface is not allowed, and private + """This value can be set to 'Enabled' to avoid breaking changes on existing customer resources and + templates. If set to 'Disabled', traffic over public interface is not allowed, and private endpoint connections would be the exclusive access method. """ - ENABLED = "enabled" + ENABLED = "Enabled" """The search service is accessible from traffic originating from the public internet.""" - DISABLED = "disabled" + DISABLED = "Disabled" """The search service is not accessible from traffic originating from the public internet. Access is only permitted over approved private endpoint connections.""" - SECURED_BY_PERIMETER = "securedByPerimeter" + SECURED_BY_PERIMETER = "SecuredByPerimeter" """The network security perimeter configuration rules allow or disallow public network access to the resource. Requires an associated network security perimeter.""" @@ -211,11 +247,11 @@ class ResourceAssociationAccessMode(str, Enum, metaclass=CaseInsensitiveEnumMeta """Access mode of the resource association.""" ENFORCED = "Enforced" - """Enforced access mode - traffic to the resource that failed access checks is blocked""" + """Enforced access mode - traffic to the resource that failed access checks is blocked.""" LEARNING = "Learning" - """Learning access mode - traffic to the resource is enabled for analysis but not blocked""" + """Learning access mode - traffic to the resource is enabled for analysis but not blocked.""" AUDIT = "Audit" - """Audit access mode - traffic to the resource that fails access checks is logged but not blocked""" + """Audit access mode - traffic to the resource that fails access checks is logged but not blocked.""" class SearchBypass(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -224,6 +260,9 @@ class SearchBypass(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" """Indicates that no origin can bypass the rules defined in the 'ipRules' section. This is the default.""" + AZURE_PORTAL = "AzurePortal" + """Indicates that requests originating from the Azure Portal can bypass the rules defined in the + 'ipRules' section.""" AZURE_SERVICES = "AzureServices" """Indicates that requests originating from Azure trusted services can bypass the rules defined in the 'ipRules' section.""" @@ -266,19 +305,20 @@ class SearchEncryptionWithCmk(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SearchSemanticSearch(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Sets options that control the availability of semantic search. This configuration is only - possible for certain Azure AI Search SKUs in certain locations. + """Specifies the availability and billing plan for semantic search on the Azure AI Search service. + This configuration is only available for certain pricing tiers in certain regions. """ DISABLED = "disabled" - """Indicates that semantic reranker is disabled for the search service. This is the default.""" + """Indicates that semantic reranker is disabled for the search service.""" FREE = "free" """Enables semantic reranker on a search service and indicates that it is to be used within the limits of the free plan. The free plan would cap the volume of semantic ranking requests and is - offered at no extra charge. This is the default for newly provisioned search services.""" + offered at no extra charge. This is the default for newly provisioned search services. This is + the default.""" STANDARD = "standard" - """Enables semantic reranker on a search service as a billable feature, with higher throughput and - volume of semantically reranked queries.""" + """Enables semantic reranker on a search service as a billable feature after the free quota is + exhausted, with higher throughput and volume of semantically reranked queries.""" class SearchServiceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -316,18 +356,14 @@ class Severity(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Severity of the issue.""" WARNING = "Warning" + """WARNING.""" ERROR = "Error" + """ERROR.""" -class SharedPrivateLinkResourceAsyncOperationResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current status of the long running asynchronous shared private link resource operation.""" - - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - - -class SharedPrivateLinkResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): +class SharedPrivateLinkResourceProvisioningState( # pylint: disable=name-too-long + str, Enum, metaclass=CaseInsensitiveEnumMeta +): """The provisioning state of the shared private link resource. Valid values are Updating, Deleting, Failed, Succeeded or Incomplete. """ @@ -368,7 +404,8 @@ class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 partitions with more indexes if you also set the hostingMode property to 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. - 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. + 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions. 'serverless': + Serverless tier with auto-scaling capabilities. """ FREE = "free" @@ -386,6 +423,9 @@ class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Billable tier for a dedicated service that supports 1TB per partition, up to 12 partitions.""" STORAGE_OPTIMIZED_L2 = "storage_optimized_l2" """Billable tier for a dedicated service that supports 2TB per partition, up to 12 partitions.""" + SERVERLESS = "serverless" + """Serverless tier, offering low-touch, consumption-based, and pay-as-you-go experience, with + auto-scaling capabilities.""" class UnavailableNameReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -401,9 +441,9 @@ class UnavailableNameReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): class UpgradeAvailable(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates if the search service has an upgrade available.""" + """Indicates if the dedicated search service has an upgrade available.""" NOT_AVAILABLE = "notAvailable" - """An upgrade is currently not available for the service.""" + """An upgrade is currently not available for the dedicated service.""" AVAILABLE = "available" - """There is an upgrade available for the service.""" + """There is an upgrade available for the dedicated service.""" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models.py new file mode 100644 index 000000000000..b7617cbf7bfc --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models.py @@ -0,0 +1,2531 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class AccessRule(_Model): + """Access rule in a network security perimeter configuration profile. + + :ivar name: Name of the access rule. + :vartype name: str + :ivar properties: + :vartype properties: ~azure.mgmt.search.models.AccessRuleProperties + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the access rule.""" + properties: Optional["_models.AccessRuleProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.AccessRuleProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessRuleProperties(_Model): + """Properties of Access Rule. + + :ivar direction: Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.search.models.AccessRuleDirection + :ivar address_prefixes: Address prefixes in the CIDR format for inbound rules. + :vartype address_prefixes: list[str] + :ivar subscriptions: Subscriptions for inbound rules. + :vartype subscriptions: list[~azure.mgmt.search.models.AccessRulePropertiesSubscriptionsItem] + :ivar network_security_perimeters: Network security perimeters for inbound rules. + :vartype network_security_perimeters: list[~azure.mgmt.search.models.NetworkSecurityPerimeter] + :ivar fully_qualified_domain_names: Fully qualified domain names (FQDN) for outbound rules. + :vartype fully_qualified_domain_names: list[str] + :ivar email_addresses: Email addresses for outbound rules. + :vartype email_addresses: list[str] + :ivar phone_numbers: Phone numbers for outbound rules. + :vartype phone_numbers: list[str] + """ + + direction: Optional[Union[str, "_models.AccessRuleDirection"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Known values are: \"Inbound\" and \"Outbound\".""" + address_prefixes: Optional[list[str]] = rest_field( + name="addressPrefixes", visibility=["read", "create", "update", "delete", "query"] + ) + """Address prefixes in the CIDR format for inbound rules.""" + subscriptions: Optional[list["_models.AccessRulePropertiesSubscriptionsItem"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Subscriptions for inbound rules.""" + network_security_perimeters: Optional[list["_models.NetworkSecurityPerimeter"]] = rest_field( + name="networkSecurityPerimeters", visibility=["read", "create", "update", "delete", "query"] + ) + """Network security perimeters for inbound rules.""" + fully_qualified_domain_names: Optional[list[str]] = rest_field( + name="fullyQualifiedDomainNames", visibility=["read", "create", "update", "delete", "query"] + ) + """Fully qualified domain names (FQDN) for outbound rules.""" + email_addresses: Optional[list[str]] = rest_field( + name="emailAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + """Email addresses for outbound rules.""" + phone_numbers: Optional[list[str]] = rest_field( + name="phoneNumbers", visibility=["read", "create", "update", "delete", "query"] + ) + """Phone numbers for outbound rules.""" + + @overload + def __init__( + self, + *, + direction: Optional[Union[str, "_models.AccessRuleDirection"]] = None, + address_prefixes: Optional[list[str]] = None, + subscriptions: Optional[list["_models.AccessRulePropertiesSubscriptionsItem"]] = None, + network_security_perimeters: Optional[list["_models.NetworkSecurityPerimeter"]] = None, + fully_qualified_domain_names: Optional[list[str]] = None, + email_addresses: Optional[list[str]] = None, + phone_numbers: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AccessRulePropertiesSubscriptionsItem(_Model): + """Network security perimeter configuration. + + :ivar id: The fully qualified Azure resource ID of the subscription e.g. + ('/subscriptions/00000000-0000-0000-0000-000000000000'). + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The fully qualified Azure resource ID of the subscription e.g. + ('/subscriptions/00000000-0000-0000-0000-000000000000').""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AdminKeyResult(_Model): + """Response containing the primary and secondary admin API keys for a given Azure AI Search + service. + + :ivar primary_key: The primary admin API key of the search service. + :vartype primary_key: str + :ivar secondary_key: The secondary admin API key of the search service. + :vartype secondary_key: str + """ + + primary_key: Optional[str] = rest_field(name="primaryKey", visibility=["read"]) + """The primary admin API key of the search service.""" + secondary_key: Optional[str] = rest_field(name="secondaryKey", visibility=["read"]) + """The secondary admin API key of the search service.""" + + +class AzureActiveDirectoryApplicationCredentials(_Model): # pylint: disable=name-too-long + """Describes the Azure Active Directory application credentials required to access an Azure Key + Vault. + + :ivar application_id: The application (client) ID of an App Registration in the tenant. + :vartype application_id: str + :ivar application_secret: An AAD client secret that was generated for the App Registration used + to authenticate with Azure Key Vault. + :vartype application_secret: str + """ + + application_id: Optional[str] = rest_field( + name="applicationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The application (client) ID of an App Registration in the tenant.""" + application_secret: Optional[str] = rest_field( + name="applicationSecret", visibility=["read", "create", "update", "delete", "query"] + ) + """An AAD client secret that was generated for the App Registration used to authenticate with + Azure Key Vault.""" + + @overload + def __init__( + self, + *, + application_id: Optional[str] = None, + application_secret: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityInput(_Model): + """Input of check name availability API. + + :ivar name: The search service name to validate. Search service names must only contain + lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, + cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. + :vartype name: str + :ivar type: The type of the resource whose name is to be validated. This value must always be + 'searchServices'. Required. Default value is "searchServices". + :vartype type: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The search service name to validate. Search service names must only contain lowercase letters, + digits or dashes, cannot use dash as the first two or last one characters, cannot contain + consecutive dashes, and must be between 2 and 60 characters in length. Required.""" + type: Literal["searchServices"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of the resource whose name is to be validated. This value must always be + 'searchServices'. Required. Default value is \"searchServices\".""" + + @overload + def __init__( + self, + *, + name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.type: Literal["searchServices"] = "searchServices" + + +class CheckNameAvailabilityOutput(_Model): + """Output of check name availability API. + + :ivar is_name_available: A value indicating whether the name is available. + :vartype is_name_available: bool + :ivar reason: The reason why the name is not available. 'Invalid' indicates the name provided + does not match the naming requirements (incorrect length, unsupported characters, etc.). + 'AlreadyExists' indicates that the name is already in use and is therefore unavailable. Known + values are: "Invalid" and "AlreadyExists". + :vartype reason: str or ~azure.mgmt.search.models.UnavailableNameReason + :ivar message: A message that explains why the name is invalid and provides resource naming + requirements. Available only if 'Invalid' is returned in the 'reason' property. + :vartype message: str + """ + + is_name_available: Optional[bool] = rest_field(name="nameAvailable", visibility=["read"]) + """A value indicating whether the name is available.""" + reason: Optional[Union[str, "_models.UnavailableNameReason"]] = rest_field(visibility=["read"]) + """The reason why the name is not available. 'Invalid' indicates the name provided does not match + the naming requirements (incorrect length, unsupported characters, etc.). 'AlreadyExists' + indicates that the name is already in use and is therefore unavailable. Known values are: + \"Invalid\" and \"AlreadyExists\".""" + message: Optional[str] = rest_field(visibility=["read"]) + """A message that explains why the name is invalid and provides resource naming requirements. + Available only if 'Invalid' is returned in the 'reason' property.""" + + +class CloudError(_Model): + """Contains information about an API error. + + :ivar error: Describes a particular API error with an error code and a message. + :vartype error: ~azure.mgmt.search.models.CloudErrorBody + :ivar message: A brief description of the error that hints at what went wrong (for + details/debugging information refer to the 'error.message' property). + :vartype message: str + """ + + error: Optional["_models.CloudErrorBody"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes a particular API error with an error code and a message.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A brief description of the error that hints at what went wrong (for details/debugging + information refer to the 'error.message' property).""" + + @overload + def __init__( + self, + *, + error: Optional["_models.CloudErrorBody"] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CloudErrorBody(_Model): + """Describes a particular API error with an error code and a message. + + :ivar code: An error code that describes the error condition more precisely than an HTTP status + code. Can be used to programmatically handle specific error cases. + :vartype code: str + :ivar message: A message that describes the error in detail and provides debugging information. + :vartype message: str + :ivar target: The target of the particular error (for example, the name of the property in + error). + :vartype target: str + :ivar details: Contains nested errors that are related to this error. + :vartype details: list[~azure.mgmt.search.models.CloudErrorBody] + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An error code that describes the error condition more precisely than an HTTP status code. Can + be used to programmatically handle specific error cases.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A message that describes the error in detail and provides debugging information.""" + target: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The target of the particular error (for example, the name of the property in error).""" + details: Optional[list["_models.CloudErrorBody"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Contains nested errors that are related to this error.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + target: Optional[str] = None, + details: Optional[list["_models.CloudErrorBody"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataIdentity(_Model): + """Abstract base type for data identities. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + DataNoneIdentity, DataUserAssignedIdentity + + :ivar odata_type: A URI fragment specifying the type of identity. Required. Default value is + None. + :vartype odata_type: str + """ + + __mapping__: dict[str, _Model] = {} + odata_type: str = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) + """A URI fragment specifying the type of identity. Required. Default value is None.""" + + @overload + def __init__( + self, + *, + odata_type: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataNoneIdentity(DataIdentity, discriminator="#Microsoft.Azure.Search.DataNoneIdentity"): + """Clears the identity property. + + :ivar odata_type: Required. Default value is "#Microsoft.Azure.Search.DataNoneIdentity". + :vartype odata_type: str + """ + + odata_type: Literal["#Microsoft.Azure.Search.DataNoneIdentity"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"#Microsoft.Azure.Search.DataNoneIdentity\".""" + + @overload + def __init__( + self, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.odata_type = "#Microsoft.Azure.Search.DataNoneIdentity" # type: ignore + + +class DataPlaneAadOrApiKeyAuthOption(_Model): + """Indicates that either the API key or an access token from a Microsoft Entra ID tenant can be + used for authentication. + + :ivar aad_auth_failure_mode: Describes what response the data plane API of a search service + would send for requests that failed authentication. Known values are: "http403" and + "http401WithBearerChallenge". + :vartype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode + """ + + aad_auth_failure_mode: Optional[Union[str, "_models.AadAuthFailureMode"]] = rest_field( + name="aadAuthFailureMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes what response the data plane API of a search service would send for requests that + failed authentication. Known values are: \"http403\" and \"http401WithBearerChallenge\".""" + + @overload + def __init__( + self, + *, + aad_auth_failure_mode: Optional[Union[str, "_models.AadAuthFailureMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataPlaneAuthOptions(_Model): + """Defines the options for how the search service authenticates a data plane request. This cannot + be set if 'disableLocalAuth' is set to true. + + :ivar api_key_only: Indicates that only the API key can be used for authentication. + :vartype api_key_only: any + :ivar aad_or_api_key: Indicates that either the API key or an access token from a Microsoft + Entra ID tenant can be used for authentication. + :vartype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption + """ + + api_key_only: Optional[Any] = rest_field( + name="apiKeyOnly", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates that only the API key can be used for authentication.""" + aad_or_api_key: Optional["_models.DataPlaneAadOrApiKeyAuthOption"] = rest_field( + name="aadOrApiKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates that either the API key or an access token from a Microsoft Entra ID tenant can be + used for authentication.""" + + @overload + def __init__( + self, + *, + api_key_only: Optional[Any] = None, + aad_or_api_key: Optional["_models.DataPlaneAadOrApiKeyAuthOption"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DataUserAssignedIdentity(DataIdentity, discriminator="#Microsoft.Azure.Search.DataUserAssignedIdentity"): + """Specifies the user assigned identity to use. + + :ivar odata_type: Required. Default value is + "#Microsoft.Azure.Search.DataUserAssignedIdentity". + :vartype odata_type: str + :ivar user_assigned_identity: The fully qualified Azure resource Id of a user assigned managed + identity typically in the form + "/subscriptions/12345678-1234-1234-1234-1234567890ab/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId" + that should have been assigned to the search service. Required. + :vartype user_assigned_identity: str + :ivar federated_identity_client_id: Optional for Multi-tenant User-Assigned Managed Identity + CMK Support: The client id (as a UUID) of the multi-tenant App Registration that has been + configured to federate with the userAssignedIdentity. + :vartype federated_identity_client_id: str + """ + + odata_type: Literal["#Microsoft.Azure.Search.DataUserAssignedIdentity"] = rest_discriminator(name="@odata.type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Default value is \"#Microsoft.Azure.Search.DataUserAssignedIdentity\".""" + user_assigned_identity: str = rest_field( + name="userAssignedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """The fully qualified Azure resource Id of a user assigned managed identity typically in the form + \"/subscriptions/12345678-1234-1234-1234-1234567890ab/resourceGroups/rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId\" + that should have been assigned to the search service. Required.""" + federated_identity_client_id: Optional[str] = rest_field( + name="federatedIdentityClientId", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional for Multi-tenant User-Assigned Managed Identity CMK Support: The client id (as a UUID) + of the multi-tenant App Registration that has been configured to federate with the + userAssignedIdentity.""" + + @overload + def __init__( + self, + *, + user_assigned_identity: str, + federated_identity_client_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + self.odata_type = "#Microsoft.Azure.Search.DataUserAssignedIdentity" # type: ignore + + +class EncryptionWithCmk(_Model): + """Describes a policy that determines how resources within the search service are to be encrypted + with customer managed keys. + + :ivar enforcement: Describes how a search service should enforce compliance if it finds objects + that aren't encrypted with the customer-managed key. Known values are: "Disabled", "Enabled", + and "Unspecified". + :vartype enforcement: str or ~azure.mgmt.search.models.SearchEncryptionWithCmk + :ivar encryption_compliance_status: Returns the status of search service compliance with + respect to non-CMK-encrypted objects. If a service has more than one unencrypted object, and + enforcement is enabled, the service is marked as noncompliant. Known values are: "Compliant" + and "NonCompliant". + :vartype encryption_compliance_status: str or + ~azure.mgmt.search.models.SearchEncryptionComplianceStatus + :ivar service_level_encryption_key: Describes the customer-managed key configuration for + encrypting the search service. + :vartype service_level_encryption_key: ~azure.mgmt.search.models.SearchResourceEncryptionKey + """ + + enforcement: Optional[Union[str, "_models.SearchEncryptionWithCmk"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes how a search service should enforce compliance if it finds objects that aren't + encrypted with the customer-managed key. Known values are: \"Disabled\", \"Enabled\", and + \"Unspecified\".""" + encryption_compliance_status: Optional[Union[str, "_models.SearchEncryptionComplianceStatus"]] = rest_field( + name="encryptionComplianceStatus", visibility=["read"] + ) + """Returns the status of search service compliance with respect to non-CMK-encrypted objects. If a + service has more than one unencrypted object, and enforcement is enabled, the service is marked + as noncompliant. Known values are: \"Compliant\" and \"NonCompliant\".""" + service_level_encryption_key: Optional["_models.SearchResourceEncryptionKey"] = rest_field( + name="serviceLevelEncryptionKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the customer-managed key configuration for encrypting the search service.""" + + @overload + def __init__( + self, + *, + enforcement: Optional[Union[str, "_models.SearchEncryptionWithCmk"]] = None, + service_level_encryption_key: Optional["_models.SearchResourceEncryptionKey"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FeatureOffering(_Model): + """Describes the availability of a specific feature in a region. + + :ivar name: The name of the feature offered in this region. + :vartype name: str + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the feature offered in this region.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Identity(_Model): + """Details about the search service identity. A null value indicates that the search service has + no identity assigned. + + :ivar principal_id: The principal ID of the system-assigned identity of the search service. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system-assigned identity of the search service. + :vartype tenant_id: str + :ivar type: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' + includes both an identity created by the system and a set of user assigned identities. The type + 'None' will remove all identities from the service. Required. Known values are: "None", + "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". + :vartype type: str or ~azure.mgmt.search.models.IdentityType + :ivar user_assigned_identities: The list of user 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}'. + :vartype user_assigned_identities: dict[str, ~azure.mgmt.search.models.UserAssignedIdentity] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the system-assigned identity of the search service.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of the system-assigned identity of the search service.""" + type: Union[str, "_models.IdentityType"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' includes + both an identity created by the system and a set of user assigned identities. The type 'None' + will remove all identities from the service. Required. Known values are: \"None\", + \"SystemAssigned\", \"UserAssigned\", and \"SystemAssigned, UserAssigned\".""" + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of user identities associated with the resource. The user identity dictionary key + references will be ARM resource IDs in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.IdentityType"], + user_assigned_identities: Optional[dict[str, "_models.UserAssignedIdentity"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IpRule(_Model): + """The IP restriction rule of the Azure AI Search service. + + :ivar value: Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in + CIDR format (eg., 123.1.2.3/24) to be allowed. + :vartype value: str + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in CIDR format + (eg., 123.1.2.3/24) to be allowed.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkRuleSet(_Model): + """Network specific rules that determine how the Azure AI Search service may be reached. + + :ivar ip_rules: A list of IP restriction rules that defines the inbound network(s) with + allowing access to the search service endpoint. At the meantime, all other public IP networks + are blocked by the firewall. These restriction rules are applied only when the + 'publicNetworkAccess' of the search service is 'enabled'; otherwise, traffic over public + interface is not allowed even with any public IP rules, and private endpoint connections would + be the exclusive access method. + :vartype ip_rules: list[~azure.mgmt.search.models.IpRule] + :ivar bypass: Possible origins of inbound traffic that can bypass the rules defined in the + 'ipRules' section. Known values are: "None", "AzurePortal", and "AzureServices". + :vartype bypass: str or ~azure.mgmt.search.models.SearchBypass + """ + + ip_rules: Optional[list["_models.IpRule"]] = rest_field( + name="ipRules", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of IP restriction rules that defines the inbound network(s) with allowing access to the + search service endpoint. At the meantime, all other public IP networks are blocked by the + firewall. These restriction rules are applied only when the 'publicNetworkAccess' of the search + service is 'enabled'; otherwise, traffic over public interface is not allowed even with any + public IP rules, and private endpoint connections would be the exclusive access method.""" + bypass: Optional[Union[str, "_models.SearchBypass"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Possible origins of inbound traffic that can bypass the rules defined in the 'ipRules' section. + Known values are: \"None\", \"AzurePortal\", and \"AzureServices\".""" + + @overload + def __init__( + self, + *, + ip_rules: Optional[list["_models.IpRule"]] = None, + bypass: Optional[Union[str, "_models.SearchBypass"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkSecurityPerimeter(_Model): + """Information about a network security perimeter (NSP). + + :ivar id: Fully qualified Azure resource ID of the NSP resource. + :vartype id: str + :ivar perimeter_guid: Universal unique ID (UUID) of the network security perimeter. + :vartype perimeter_guid: str + :ivar location: Location of the network security perimeter. + :vartype location: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Fully qualified Azure resource ID of the NSP resource.""" + perimeter_guid: Optional[str] = rest_field( + name="perimeterGuid", visibility=["read", "create", "update", "delete", "query"] + ) + """Universal unique ID (UUID) of the network security perimeter.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """Location of the network security perimeter.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + perimeter_guid: Optional[str] = None, + location: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + """ + + +class NetworkSecurityPerimeterConfiguration(ProxyResource): + """Network security perimeter (NSP) configuration resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + :ivar properties: Network security configuration properties. + :vartype properties: ~azure.mgmt.search.models.NetworkSecurityPerimeterConfigurationProperties + """ + + properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Network security configuration properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkSecurityPerimeterConfigurationProperties(_Model): # pylint: disable=name-too-long + """Network security configuration properties. + + :ivar provisioning_state: Known values are: "Succeeded", "Creating", "Updating", "Deleting", + "Accepted", "Failed", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.search.models.NetworkSecurityPerimeterConfigurationProvisioningState + :ivar provisioning_issues: List of provisioning issues, if any. + :vartype provisioning_issues: list[~azure.mgmt.search.models.ProvisioningIssue] + :ivar network_security_perimeter: + :vartype network_security_perimeter: ~azure.mgmt.search.models.NetworkSecurityPerimeter + :ivar resource_association: + :vartype resource_association: ~azure.mgmt.search.models.ResourceAssociation + :ivar profile: + :vartype profile: ~azure.mgmt.search.models.NetworkSecurityProfile + """ + + provisioning_state: Optional[Union[str, "_models.NetworkSecurityPerimeterConfigurationProvisioningState"]] = ( + rest_field(name="provisioningState", visibility=["read"]) + ) + """Known values are: \"Succeeded\", \"Creating\", \"Updating\", \"Deleting\", \"Accepted\", + \"Failed\", and \"Canceled\".""" + provisioning_issues: Optional[list["_models.ProvisioningIssue"]] = rest_field( + name="provisioningIssues", visibility=["read"] + ) + """List of provisioning issues, if any.""" + network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = rest_field( + name="networkSecurityPerimeter", visibility=["read", "create", "update", "delete", "query"] + ) + resource_association: Optional["_models.ResourceAssociation"] = rest_field( + name="resourceAssociation", visibility=["read", "create", "update", "delete", "query"] + ) + profile: Optional["_models.NetworkSecurityProfile"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = None, + resource_association: Optional["_models.ResourceAssociation"] = None, + profile: Optional["_models.NetworkSecurityProfile"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkSecurityProfile(_Model): + """Network security perimeter configuration profile. + + :ivar name: Name of the profile. + :vartype name: str + :ivar access_rules_version: Current access rules version. + :vartype access_rules_version: int + :ivar access_rules: List of Access Rules. + :vartype access_rules: list[~azure.mgmt.search.models.AccessRule] + :ivar diagnostic_settings_version: Current diagnostic settings version. + :vartype diagnostic_settings_version: int + :ivar enabled_log_categories: List of log categories that are enabled. + :vartype enabled_log_categories: list[str] + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the profile.""" + access_rules_version: Optional[int] = rest_field( + name="accessRulesVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Current access rules version.""" + access_rules: Optional[list["_models.AccessRule"]] = rest_field( + name="accessRules", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Access Rules.""" + diagnostic_settings_version: Optional[int] = rest_field( + name="diagnosticSettingsVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Current diagnostic settings version.""" + enabled_log_categories: Optional[list[str]] = rest_field( + name="enabledLogCategories", visibility=["read", "create", "update", "delete", "query"] + ) + """List of log categories that are enabled.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + access_rules_version: Optional[int] = None, + access_rules: Optional[list["_models.AccessRule"]] = None, + diagnostic_settings_version: Optional[int] = None, + enabled_log_categories: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OfferingsByRegion(_Model): + """Describes the Azure AI Search features and SKUs available in a specific Azure region. + + :ivar region_name: The name of the region. + :vartype region_name: str + :ivar features: The list of features offered in this region. + :vartype features: list[~azure.mgmt.search.models.FeatureOffering] + :ivar skus: The list of SKUs offered in this region. + :vartype skus: list[~azure.mgmt.search.models.SkuOffering] + """ + + region_name: Optional[str] = rest_field( + name="regionName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the region.""" + features: Optional[list["_models.FeatureOffering"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of features offered in this region.""" + skus: Optional[list["_models.SkuOffering"]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of SKUs offered in this region.""" + + @overload + def __init__( + self, + *, + region_name: Optional[str] = None, + features: Optional[list["_models.FeatureOffering"]] = None, + skus: Optional[list["_models.SkuOffering"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OfferingsListResult(_Model): + """Response containing the list of offerings available in Azure AI Search, organized by region. + + :ivar value: The list of Azure AI Search offerings by region. + :vartype value: list[~azure.mgmt.search.models.OfferingsByRegion] + :ivar next_link: The URL to get the next set of offerings, if any. + :vartype next_link: str + """ + + value: Optional[list["_models.OfferingsByRegion"]] = rest_field(visibility=["read"]) + """The list of Azure AI Search offerings by region.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read"]) + """The URL to get the next set of offerings, if any.""" + + +class Operation(_Model): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.search.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.search.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.search.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """Localized display information for an operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class PrivateEndpointConnection(ProxyResource): + """Describes an existing private endpoint connection to the Azure AI Search service. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + :ivar properties: Describes the properties of an existing private endpoint connection to the + Azure AI Search service. + :vartype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of an existing private endpoint connection to the Azure AI Search + service.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnectionProperties(_Model): + """Describes the properties of an existing private endpoint connection to the search service. + + :ivar private_endpoint: The private endpoint resource from Microsoft.Network provider. + :vartype private_endpoint: + ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateEndpoint + :ivar private_link_service_connection_state: Describes the current state of an existing Azure + Private Link service connection to the private endpoint. + :vartype private_link_service_connection_state: + ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + :ivar group_id: The group ID of the Azure resource for which the private link service is for. + :vartype group_id: str + :ivar provisioning_state: The provisioning state of the private link service connection. Valid + values are Updating, Deleting, Failed, Succeeded, Incomplete, or Canceled. Known values are: + "Updating", "Deleting", "Failed", "Succeeded", "Incomplete", and "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState + """ + + private_endpoint: Optional["_models.PrivateEndpointConnectionPropertiesPrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The private endpoint resource from Microsoft.Network provider.""" + private_link_service_connection_state: Optional[ + "_models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState" + ] = rest_field(name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"]) + """Describes the current state of an existing Azure Private Link service connection to the private + endpoint.""" + group_id: Optional[str] = rest_field(name="groupId", visibility=["read", "create", "update", "delete", "query"]) + """The group ID of the Azure resource for which the private link service is for.""" + provisioning_state: Optional[Union[str, "_models.PrivateLinkServiceConnectionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """The provisioning state of the private link service connection. Valid values are Updating, + Deleting, Failed, Succeeded, Incomplete, or Canceled. Known values are: \"Updating\", + \"Deleting\", \"Failed\", \"Succeeded\", \"Incomplete\", and \"Canceled\".""" + + @overload + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpointConnectionPropertiesPrivateEndpoint"] = None, + private_link_service_connection_state: Optional[ + "_models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState" + ] = None, + group_id: Optional[str] = None, + provisioning_state: Optional[Union[str, "_models.PrivateLinkServiceConnectionProvisioningState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnectionPropertiesPrivateEndpoint(_Model): # pylint: disable=name-too-long + """The private endpoint resource from Microsoft.Network provider. + + :ivar id: The resource ID of the private endpoint resource from Microsoft.Network provider. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the private endpoint resource from Microsoft.Network provider.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState(_Model): # pylint: disable=name-too-long + """Describes the current state of an existing Azure Private Link service connection to the private + endpoint. + + :ivar status: Status of the the private link service connection. Valid values are Pending, + Approved, Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and + "Disconnected". + :vartype status: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionStatus + :ivar description: The description for the private link service connection state. + :vartype description: str + :ivar actions_required: A description of any extra actions that may be required. + :vartype actions_required: str + """ + + status: Optional[Union[str, "_models.PrivateLinkServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Status of the the private link service connection. Valid values are Pending, Approved, + Rejected, or Disconnected. Known values are: \"Pending\", \"Approved\", \"Rejected\", and + \"Disconnected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description for the private link service connection state.""" + actions_required: Optional[str] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A description of any extra actions that may be required.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateLinkServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResource(Resource): + """Describes a supported private link resource for the Azure AI Search service. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + :ivar properties: Describes the properties of a supported private link resource for the Azure + AI Search service. + :vartype properties: ~azure.mgmt.search.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field(visibility=["read"]) + """Describes the properties of a supported private link resource for the Azure AI Search service.""" + + +class PrivateLinkResourceProperties(_Model): + """Describes the properties of a supported private link resource for the Azure AI Search service. + For a given API version, this represents the 'supported' groupIds when creating a shared + private link resource. + + :ivar group_id: The group ID of the private link resource. + :vartype group_id: str + :ivar required_members: The list of required members of the private link resource. + :vartype required_members: list[str] + :ivar required_zone_names: The list of required DNS zone names of the private link resource. + :vartype required_zone_names: list[str] + :ivar shareable_private_link_resource_types: The list of resources that are onboarded to + private link service, that are supported by Azure AI Search. + :vartype shareable_private_link_resource_types: + list[~azure.mgmt.search.models.ShareablePrivateLinkResourceType] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The group ID of the private link resource.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The list of required members of the private link resource.""" + required_zone_names: Optional[list[str]] = rest_field(name="requiredZoneNames", visibility=["read"]) + """The list of required DNS zone names of the private link resource.""" + shareable_private_link_resource_types: Optional[list["_models.ShareablePrivateLinkResourceType"]] = rest_field( + name="shareablePrivateLinkResourceTypes", visibility=["read"] + ) + """The list of resources that are onboarded to private link service, that are supported by Azure + AI Search.""" + + +class ProvisioningIssue(_Model): + """Describes a provisioning issue for a network security perimeter configuration. + + :ivar name: Name of the issue. + :vartype name: str + :ivar properties: + :vartype properties: ~azure.mgmt.search.models.ProvisioningIssueProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the issue.""" + properties: Optional["_models.ProvisioningIssueProperties"] = rest_field(visibility=["read"]) + + +class ProvisioningIssueProperties(_Model): + """Details of a provisioning issue for a network security perimeter (NSP) configuration. Resource + providers should generate separate provisioning issue elements for each separate issue + detected, and include a meaningful and distinctive description, as well as any appropriate + suggestedResourceIds and suggestedAccessRules. + + :ivar issue_type: Type of issue. Known values are: "Unknown", + "ConfigurationPropagationFailure", "MissingPerimeterConfiguration", and + "MissingIdentityConfiguration". + :vartype issue_type: str or ~azure.mgmt.search.models.IssueType + :ivar severity: Severity of the issue. Known values are: "Warning" and "Error". + :vartype severity: str or ~azure.mgmt.search.models.Severity + :ivar description: Description of the issue. + :vartype description: str + :ivar suggested_resource_ids: Fully qualified resource IDs of suggested resources that can be + associated to the network security perimeter (NSP) to remediate the issue. + :vartype suggested_resource_ids: list[str] + :ivar suggested_access_rules: Access rules that can be added to the network security profile + (NSP) to remediate the issue. + :vartype suggested_access_rules: list[~azure.mgmt.search.models.AccessRule] + """ + + issue_type: Optional[Union[str, "_models.IssueType"]] = rest_field(name="issueType", visibility=["read"]) + """Type of issue. Known values are: \"Unknown\", \"ConfigurationPropagationFailure\", + \"MissingPerimeterConfiguration\", and \"MissingIdentityConfiguration\".""" + severity: Optional[Union[str, "_models.Severity"]] = rest_field(visibility=["read"]) + """Severity of the issue. Known values are: \"Warning\" and \"Error\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """Description of the issue.""" + suggested_resource_ids: Optional[list[str]] = rest_field(name="suggestedResourceIds", visibility=["read"]) + """Fully qualified resource IDs of suggested resources that can be associated to the network + security perimeter (NSP) to remediate the issue.""" + suggested_access_rules: Optional[list["_models.AccessRule"]] = rest_field( + name="suggestedAccessRules", visibility=["read"] + ) + """Access rules that can be added to the network security profile (NSP) to remediate the issue.""" + + +class QueryKey(_Model): + """Describes an API key for a given Azure AI Search service that conveys read-only permissions on + the docs collection of an index. + + :ivar name: The name of the query API key. Query names are optional, but assigning a name can + help you remember how it's used. + :vartype name: str + :ivar key: The value of the query API key. + :vartype key: str + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the query API key. Query names are optional, but assigning a name can help you + remember how it's used.""" + key: Optional[str] = rest_field(visibility=["read"]) + """The value of the query API key.""" + + +class QuotaUsageResult(_Model): + """Describes the quota usage for a particular SKU. + + :ivar id: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. + :vartype id: str + :ivar unit: The unit of measurement for the search SKU. + :vartype unit: str + :ivar current_value: The currently used up value for the particular search SKU. + :vartype current_value: int + :ivar limit: The quota limit for the particular search SKU. + :vartype limit: int + :ivar name: The SKU name information of the current search service. + :vartype name: ~azure.mgmt.search.models.QuotaUsageResultName + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the quota usage SKU endpoint for Microsoft.Search provider.""" + unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The unit of measurement for the search SKU.""" + current_value: Optional[int] = rest_field( + name="currentValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The currently used up value for the particular search SKU.""" + limit: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The quota limit for the particular search SKU.""" + name: Optional["_models.QuotaUsageResultName"] = rest_field(visibility=["read"]) + """The SKU name information of the current search service.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + unit: Optional[str] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class QuotaUsageResultName(_Model): + """The SKU name information, including its identifier and localized display name. + + :ivar value: The SKU name supported by Azure AI Search. + :vartype value: str + :ivar localized_value: The localized string value for the SKU name. + :vartype localized_value: str + """ + + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU name supported by Azure AI Search.""" + localized_value: Optional[str] = rest_field( + name="localizedValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The localized string value for the SKU name.""" + + @overload + def __init__( + self, + *, + value: Optional[str] = None, + localized_value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceAssociation(_Model): + """Information about resource association. + + :ivar name: Name of the resource association. + :vartype name: str + :ivar access_mode: Known values are: "Enforced", "Learning", and "Audit". + :vartype access_mode: str or ~azure.mgmt.search.models.ResourceAssociationAccessMode + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the resource association.""" + access_mode: Optional[Union[str, "_models.ResourceAssociationAccessMode"]] = rest_field( + name="accessMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Known values are: \"Enforced\", \"Learning\", and \"Audit\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + access_mode: Optional[Union[str, "_models.ResourceAssociationAccessMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SearchResourceEncryptionKey(_Model): + """A customer-managed encryption key in Azure Key Vault. Keys that you create and manage can be + used to encrypt or decrypt data-at-rest, such as indexes and synonym maps. + + :ivar key_name: The name of your Azure Key Vault key to be used to encrypt your data at rest. + :vartype key_name: str + :ivar key_version: The version of your Azure Key Vault key to be used to encrypt your data at + rest. + :vartype key_version: str + :ivar vault_uri: The URI of your Azure Key Vault, also referred to as DNS name, that contains + the key to be used to encrypt your data at rest. An example URI might be + ``https://my-keyvault-name.vault.azure.net``. + :vartype vault_uri: str + :ivar identity: An explicit managed identity to use for this encryption key. If not specified + and the access credentials property is null, the system-assigned managed identity is used. On + update to the resource, if the explicit identity is unspecified, it remains unchanged. If + "none" is specified, the value of this property is cleared. + :vartype identity: ~azure.mgmt.search.models.DataIdentity + :ivar access_credentials: Optional Azure Active Directory credentials used for accessing your + Azure Key Vault. Not required if using managed identity instead. + :vartype access_credentials: + ~azure.mgmt.search.models.AzureActiveDirectoryApplicationCredentials + """ + + key_name: Optional[str] = rest_field( + name="keyVaultKeyName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of your Azure Key Vault key to be used to encrypt your data at rest.""" + key_version: Optional[str] = rest_field( + name="keyVaultKeyVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The version of your Azure Key Vault key to be used to encrypt your data at rest.""" + vault_uri: Optional[str] = rest_field( + name="keyVaultUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The URI of your Azure Key Vault, also referred to as DNS name, that contains the key to be used + to encrypt your data at rest. An example URI might be + ``https://my-keyvault-name.vault.azure.net``.""" + identity: Optional["_models.DataIdentity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """An explicit managed identity to use for this encryption key. If not specified and the access + credentials property is null, the system-assigned managed identity is used. On update to the + resource, if the explicit identity is unspecified, it remains unchanged. If \"none\" is + specified, the value of this property is cleared.""" + access_credentials: Optional["_models.AzureActiveDirectoryApplicationCredentials"] = rest_field( + name="accessCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional Azure Active Directory credentials used for accessing your Azure Key Vault. Not + required if using managed identity instead.""" + + @overload + def __init__( + self, + *, + key_name: Optional[str] = None, + key_version: Optional[str] = None, + vault_uri: Optional[str] = None, + identity: Optional["_models.DataIdentity"] = None, + access_credentials: Optional["_models.AzureActiveDirectoryApplicationCredentials"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SearchService(TrackedResource): + """Describes an Azure AI Search service and its current state. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: Properties of the search service. + :vartype properties: ~azure.mgmt.search.models.SearchServiceProperties + :ivar sku: The SKU of the search service, which determines price tier and capacity limits. This + property is required when creating a new search service. + :vartype sku: ~azure.mgmt.search.models.Sku + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.search.models.Identity + """ + + properties: Optional["_models.SearchServiceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the search service.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU of the search service, which determines price tier and capacity limits. This property + is required when creating a new search service.""" + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The identity of the resource.""" + + __flattened_items = [ + "replica_count", + "partition_count", + "endpoint", + "hosting_mode", + "compute_type", + "public_network_access", + "status", + "status_details", + "provisioning_state", + "network_rule_set", + "data_exfiltration_protections", + "encryption_with_cmk", + "disable_local_auth", + "auth_options", + "semantic_search", + "knowledge_retrieval", + "private_endpoint_connections", + "shared_private_link_resources", + "e_tag", + "upgrade_available", + "service_upgraded_at", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.SearchServiceProperties"] = None, + sku: Optional["_models.Sku"] = None, + identity: Optional["_models.Identity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SearchServiceProperties(_Model): + """Properties of the search service. + + :ivar replica_count: The number of replicas in the dedicated search service. If specified, it + must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for + basic SKU. + :vartype replica_count: int + :ivar partition_count: The number of partitions in the dedicated search service; if specified, + it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For + 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 + and 3. + :vartype partition_count: int + :ivar endpoint: The endpoint of the Azure AI Search service. + :vartype endpoint: str + :ivar hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable + up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'Default' + or 'HighDensity'. For all other SKUs, this value must be 'Default'. Known values are: "Default" + and "HighDensity". + :vartype hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :ivar compute_type: Configure this property to support the search service using either the + Default Compute or Azure Confidential Compute. Known values are: "Default" and "Confidential". + :vartype compute_type: str or ~azure.mgmt.search.models.ComputeType + :ivar public_network_access: This value can be set to 'Enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'Disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Known + values are: "Enabled", "Disabled", and "SecuredByPerimeter". + :vartype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error + state. 'stopped': The search service is in a subscription that's disabled. If your service is + in the degraded, disabled, or error states, it means the Azure AI Search team is actively + investigating the underlying issue. Dedicated services in these states are still chargeable + based on the number of search units provisioned. Known values are: "running", "provisioning", + "deleting", "degraded", "disabled", "error", and "stopped". + :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus + :ivar status_details: The details of the search service status. + :vartype status_details: str + :ivar provisioning_state: The state of the last provisioning operation performed on the search + service. Provisioning is an intermediate state that occurs while service capacity is being + established. After capacity is set up, provisioningState changes to either 'Succeeded' or + 'Failed'. Client applications can poll provisioning status (the recommended polling interval is + from 30 seconds to one minute) by using the Get Search Service operation to see when an + operation is completed. If you are using the free service, this value tends to come back as + 'Succeeded' directly in the call to Create search service. This is because the free service + uses capacity that is already set up. Known values are: "succeeded", "provisioning", and + "failed". + :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState + :ivar network_rule_set: Network specific rules that determine how the Azure AI Search service + may be reached. + :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar data_exfiltration_protections: A list of data exfiltration scenarios that are explicitly + disallowed for the search service. Currently, the only supported value is 'All' to disable all + possible data export scenarios with more fine grained controls planned for the future. + :vartype data_exfiltration_protections: list[str or + ~azure.mgmt.search.models.SearchDataExfiltrationProtection] + :ivar encryption_with_cmk: Specifies any policy regarding encryption of resources (such as + indexes) using customer manager keys within a search service. + :vartype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk + :ivar disable_local_auth: When set to true, calls to the search service will not be permitted + to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' + are defined. + :vartype disable_local_auth: bool + :ivar auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :vartype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions + :ivar semantic_search: Specifies the availability and billing plan for semantic search on the + Azure AI Search service. This configuration is only available for certain pricing tiers in + certain regions. Known values are: "disabled", "free", and "standard". + :vartype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch + :ivar knowledge_retrieval: Specifies the billing plan for agentic retrieval on the Azure AI + Search service. This configuration is only available for certain pricing tiers in certain + regions. Known values are: "free" and "standard". + :vartype knowledge_retrieval: str or ~azure.mgmt.search.models.KnowledgeRetrieval + :ivar private_endpoint_connections: The list of private endpoint connections to the Azure AI + Search service. + :vartype private_endpoint_connections: + list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure AI Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] + :ivar e_tag: A system generated property representing the service's etag that can be for + optimistic concurrency control during updates. + :vartype e_tag: str + :ivar upgrade_available: Indicates if the search service has an upgrade available. Known values + are: "notAvailable" and "available". + :vartype upgrade_available: str or ~azure.mgmt.search.models.UpgradeAvailable + :ivar service_upgraded_at: The date and time the search service was last upgraded. This field + will be null until the service gets upgraded for the first time. + :vartype service_upgraded_at: ~datetime.datetime + """ + + replica_count: Optional[int] = rest_field( + name="replicaCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of replicas in the dedicated search service. If specified, it must be a value + between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU.""" + partition_count: Optional[int] = rest_field( + name="partitionCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of partitions in the dedicated search service; if specified, it can be 1, 2, 3, 4, + 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with + hostingMode set to 'highDensity', the allowed values are between 1 and 3.""" + endpoint: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The endpoint of the Azure AI Search service.""" + hosting_mode: Optional[Union[str, "_models.HostingMode"]] = rest_field( + name="hostingMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Applicable only for the standard3 SKU. You can set this property to enable up to 3 high density + partitions that allow up to 1000 indexes, which is much higher than the maximum indexes allowed + for any other SKU. For the standard3 SKU, the value is either 'Default' or 'HighDensity'. For + all other SKUs, this value must be 'Default'. Known values are: \"Default\" and + \"HighDensity\".""" + compute_type: Optional[Union[str, "_models.ComputeType"]] = rest_field( + name="computeType", visibility=["read", "create", "update", "delete", "query"] + ) + """Configure this property to support the search service using either the Default Compute or Azure + Confidential Compute. Known values are: \"Default\" and \"Confidential\".""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """This value can be set to 'Enabled' to avoid breaking changes on existing customer resources and + templates. If set to 'Disabled', traffic over public interface is not allowed, and private + endpoint connections would be the exclusive access method. Known values are: \"Enabled\", + \"Disabled\", and \"SecuredByPerimeter\".""" + status: Optional[Union[str, "_models.SearchServiceStatus"]] = rest_field(visibility=["read"]) + """The status of the search service. Possible values include: 'running': The search service is + running and no provisioning operations are underway. 'provisioning': The search service is + being provisioned or scaled up or down. 'deleting': The search service is being deleted. + 'degraded': The search service is degraded. This can occur when the underlying search units are + not healthy. The search service is most likely operational, but performance might be slow and + some requests might be dropped. 'disabled': The search service is disabled. In this state, the + service will reject all API requests. 'error': The search service is in an error state. + 'stopped': The search service is in a subscription that's disabled. If your service is in the + degraded, disabled, or error states, it means the Azure AI Search team is actively + investigating the underlying issue. Dedicated services in these states are still chargeable + based on the number of search units provisioned. Known values are: \"running\", + \"provisioning\", \"deleting\", \"degraded\", \"disabled\", \"error\", and \"stopped\".""" + status_details: Optional[str] = rest_field(name="statusDetails", visibility=["read"]) + """The details of the search service status.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The state of the last provisioning operation performed on the search service. Provisioning is + an intermediate state that occurs while service capacity is being established. After capacity + is set up, provisioningState changes to either 'Succeeded' or 'Failed'. Client applications can + poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by + using the Get Search Service operation to see when an operation is completed. If you are using + the free service, this value tends to come back as 'Succeeded' directly in the call to Create + search service. This is because the free service uses capacity that is already set up. Known + values are: \"succeeded\", \"provisioning\", and \"failed\".""" + network_rule_set: Optional["_models.NetworkRuleSet"] = rest_field( + name="networkRuleSet", visibility=["read", "create", "update", "delete", "query"] + ) + """Network specific rules that determine how the Azure AI Search service may be reached.""" + data_exfiltration_protections: Optional[list[Union[str, "_models.SearchDataExfiltrationProtection"]]] = rest_field( + name="dataExfiltrationProtections", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of data exfiltration scenarios that are explicitly disallowed for the search service. + Currently, the only supported value is 'All' to disable all possible data export scenarios with + more fine grained controls planned for the future.""" + encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = rest_field( + name="encryptionWithCmk", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies any policy regarding encryption of resources (such as indexes) using customer manager + keys within a search service.""" + disable_local_auth: Optional[bool] = rest_field( + name="disableLocalAuth", visibility=["read", "create", "update", "delete", "query"] + ) + """When set to true, calls to the search service will not be permitted to utilize API keys for + authentication. This cannot be set to true if 'dataPlaneAuthOptions' are defined.""" + auth_options: Optional["_models.DataPlaneAuthOptions"] = rest_field( + name="authOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Defines the options for how the data plane API of a search service authenticates requests. This + cannot be set if 'disableLocalAuth' is set to true.""" + semantic_search: Optional[Union[str, "_models.SearchSemanticSearch"]] = rest_field( + name="semanticSearch", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the availability and billing plan for semantic search on the Azure AI Search service. + This configuration is only available for certain pricing tiers in certain regions. Known values + are: \"disabled\", \"free\", and \"standard\".""" + knowledge_retrieval: Optional[Union[str, "_models.KnowledgeRetrieval"]] = rest_field( + name="knowledgeRetrieval", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the billing plan for agentic retrieval on the Azure AI Search service. This + configuration is only available for certain pricing tiers in certain regions. Known values are: + \"free\" and \"standard\".""" + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """The list of private endpoint connections to the Azure AI Search service.""" + shared_private_link_resources: Optional[list["_models.SharedPrivateLinkResource"]] = rest_field( + name="sharedPrivateLinkResources", visibility=["read"] + ) + """The list of shared private link resources managed by the Azure AI Search service.""" + e_tag: Optional[str] = rest_field(name="eTag", visibility=["read"]) + """A system generated property representing the service's etag that can be for optimistic + concurrency control during updates.""" + upgrade_available: Optional[Union[str, "_models.UpgradeAvailable"]] = rest_field( + name="upgradeAvailable", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates if the search service has an upgrade available. Known values are: \"notAvailable\" + and \"available\".""" + service_upgraded_at: Optional[datetime.datetime] = rest_field( + name="serviceUpgradedAt", visibility=["read"], format="rfc3339" + ) + """The date and time the search service was last upgraded. This field will be null until the + service gets upgraded for the first time.""" + + @overload + def __init__( + self, + *, + replica_count: Optional[int] = None, + partition_count: Optional[int] = None, + endpoint: Optional[str] = None, + hosting_mode: Optional[Union[str, "_models.HostingMode"]] = None, + compute_type: Optional[Union[str, "_models.ComputeType"]] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + network_rule_set: Optional["_models.NetworkRuleSet"] = None, + data_exfiltration_protections: Optional[list[Union[str, "_models.SearchDataExfiltrationProtection"]]] = None, + encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, + disable_local_auth: Optional[bool] = None, + auth_options: Optional["_models.DataPlaneAuthOptions"] = None, + semantic_search: Optional[Union[str, "_models.SearchSemanticSearch"]] = None, + knowledge_retrieval: Optional[Union[str, "_models.KnowledgeRetrieval"]] = None, + upgrade_available: Optional[Union[str, "_models.UpgradeAvailable"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SearchServiceUpdate(Resource): + """The parameters used to update an Azure AI Search service. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + :ivar properties: Properties of the search service. + :vartype properties: ~azure.mgmt.search.models.SearchServiceProperties + :ivar sku: The SKU of the search service, which determines price tier and capacity limits. This + property is required when creating a new search service. + :vartype sku: ~azure.mgmt.search.models.Sku + :ivar location: The geographic location of the resource. This must be one of the supported and + registered Azure geo regions (for example, West US, East US, Southeast Asia, and so forth). + This property is required when creating a new resource. + :vartype location: str + :ivar tags: Tags to help categorize the resource in the Azure portal. + :vartype tags: dict[str, str] + :ivar identity: Details about the search service identity. A null value indicates that the + search service has no identity assigned. + :vartype identity: ~azure.mgmt.search.models.Identity + """ + + properties: Optional["_models.SearchServiceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the search service.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU of the search service, which determines price tier and capacity limits. This property + is required when creating a new search service.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geographic location of the resource. This must be one of the supported and registered Azure + geo regions (for example, West US, East US, Southeast Asia, and so forth). This property is + required when creating a new resource.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Tags to help categorize the resource in the Azure portal.""" + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Details about the search service identity. A null value indicates that the search service has + no identity assigned.""" + + __flattened_items = [ + "replica_count", + "partition_count", + "endpoint", + "hosting_mode", + "compute_type", + "public_network_access", + "status", + "status_details", + "provisioning_state", + "network_rule_set", + "data_exfiltration_protections", + "encryption_with_cmk", + "disable_local_auth", + "auth_options", + "semantic_search", + "knowledge_retrieval", + "private_endpoint_connections", + "shared_private_link_resources", + "e_tag", + "upgrade_available", + "service_upgraded_at", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.SearchServiceProperties"] = None, + sku: Optional["_models.Sku"] = None, + location: Optional[str] = None, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.Identity"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ShareablePrivateLinkResourceProperties(_Model): + """Describes the properties of a resource type that has been onboarded to private link service, + supported by Azure AI Search. + + :ivar type: The resource provider type for the resource that has been onboarded to private link + service, supported by Azure AI Search. + :vartype type: str + :ivar group_id: The resource provider group id for the resource that has been onboarded to + private link service, supported by Azure AI Search. + :vartype group_id: str + :ivar description: The description of the resource type that has been onboarded to private link + service, supported by Azure AI Search. + :vartype description: str + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The resource provider type for the resource that has been onboarded to private link service, + supported by Azure AI Search.""" + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The resource provider group id for the resource that has been onboarded to private link + service, supported by Azure AI Search.""" + description: Optional[str] = rest_field(visibility=["read"]) + """The description of the resource type that has been onboarded to private link service, supported + by Azure AI Search.""" + + +class ShareablePrivateLinkResourceType(_Model): + """Describes an resource type that has been onboarded to private link service, supported by Azure + AI Search. + + :ivar name: The name of the resource type that has been onboarded to private link service, + supported by Azure AI Search. + :vartype name: str + :ivar properties: Describes the properties of a resource type that has been onboarded to + private link service, supported by Azure AI Search. + :vartype properties: ~azure.mgmt.search.models.ShareablePrivateLinkResourceProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource type that has been onboarded to private link service, supported by + Azure AI Search.""" + properties: Optional["_models.ShareablePrivateLinkResourceProperties"] = rest_field(visibility=["read"]) + """Describes the properties of a resource type that has been onboarded to private link service, + supported by Azure AI Search.""" + + +class SharedPrivateLinkResource(ProxyResource): + """Describes a shared private link resource managed by the Azure AI Search service. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.search.models.SystemData + :ivar properties: Describes the properties of a shared private link resource managed by the + Azure AI Search service. + :vartype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties + """ + + properties: Optional["_models.SharedPrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a shared private link resource managed by the Azure AI Search + service.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SharedPrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SharedPrivateLinkResourceProperties(_Model): + """Describes the properties of an existing shared private link resource managed by the Azure AI + Search service. + + :ivar private_link_resource_id: The resource ID of the resource the shared private link + resource is for. + :vartype private_link_resource_id: str + :ivar group_id: The group ID from the provider of resource the shared private link resource is + for. + :vartype group_id: str + :ivar request_message: The message for requesting approval of the shared private link resource. + :vartype request_message: str + :ivar resource_region: Optional. Can be used to specify the Azure Resource Manager location of + the resource for which a shared private link is being created. This is only required for those + resources whose DNS configuration are regional (such as Azure Kubernetes Service). + :vartype resource_region: str + :ivar status: Status of the shared private link resource. Valid values are Pending, Approved, + Rejected or Disconnected. Known values are: "Pending", "Approved", "Rejected", and + "Disconnected". + :vartype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus + :ivar provisioning_state: The provisioning state of the shared private link resource. Valid + values are Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", + "Deleting", "Failed", "Succeeded", and "Incomplete". + :vartype provisioning_state: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState + """ + + private_link_resource_id: Optional[str] = rest_field( + name="privateLinkResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource ID of the resource the shared private link resource is for.""" + group_id: Optional[str] = rest_field(name="groupId", visibility=["read", "create", "update", "delete", "query"]) + """The group ID from the provider of resource the shared private link resource is for.""" + request_message: Optional[str] = rest_field( + name="requestMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """The message for requesting approval of the shared private link resource.""" + resource_region: Optional[str] = rest_field( + name="resourceRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. Can be used to specify the Azure Resource Manager location of the resource for which + a shared private link is being created. This is only required for those resources whose DNS + configuration are regional (such as Azure Kubernetes Service).""" + status: Optional[Union[str, "_models.SharedPrivateLinkResourceStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Status of the shared private link resource. Valid values are Pending, Approved, Rejected or + Disconnected. Known values are: \"Pending\", \"Approved\", \"Rejected\", and \"Disconnected\".""" + provisioning_state: Optional[Union[str, "_models.SharedPrivateLinkResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read", "create", "update", "delete", "query"] + ) + """The provisioning state of the shared private link resource. Valid values are Updating, + Deleting, Failed, Succeeded or Incomplete. Known values are: \"Updating\", \"Deleting\", + \"Failed\", \"Succeeded\", and \"Incomplete\".""" + + @overload + def __init__( + self, + *, + private_link_resource_id: Optional[str] = None, + group_id: Optional[str] = None, + request_message: Optional[str] = None, + resource_region: Optional[str] = None, + status: Optional[Union[str, "_models.SharedPrivateLinkResourceStatus"]] = None, + provisioning_state: Optional[Union[str, "_models.SharedPrivateLinkResourceProvisioningState"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Sku(_Model): + """Defines the SKU of a search service, which determines billing rate and capacity limits. + + :ivar name: The SKU of the search service. Valid values include: 'free': Shared service. + 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 + partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search + unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or + up to 3 partitions with more indexes if you also set the hostingMode property to + 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. + 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions. 'serverless': + Serverless tier with auto-scaling capabilities. Known values are: "free", "basic", "standard", + "standard2", "standard3", "storage_optimized_l1", "storage_optimized_l2", and "serverless". + :vartype name: str or ~azure.mgmt.search.models.SkuName + """ + + name: Optional[Union[str, "_models.SkuName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated + service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 + replicas. 'standard2': Similar to standard, but with more capacity per search unit. + 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 + partitions with more indexes if you also set the hostingMode property to 'highDensity'). + 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. + 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions. 'serverless': + Serverless tier with auto-scaling capabilities. Known values are: \"free\", \"basic\", + \"standard\", \"standard2\", \"standard3\", \"storage_optimized_l1\", \"storage_optimized_l2\", + and \"serverless\".""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.SkuName"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SkuLimits(_Model): + """Describes the limits associated with a SKU offering. + + :ivar indexes: The maximum number of indexes available for this SKU. + :vartype indexes: int + :ivar indexers: The maximum number of indexers available for this SKU. + :vartype indexers: int + :ivar partition_storage_in_gigabytes: The maximum storage size in Gigabytes available for this + SKU per partition. + :vartype partition_storage_in_gigabytes: float + :ivar partition_vector_storage_in_gigabytes: The maximum vector storage size in Gigabytes + available for this SKU per partition. + :vartype partition_vector_storage_in_gigabytes: float + :ivar search_units: The maximum number of search units available for this SKU. + :vartype search_units: int + :ivar replicas: The maximum number of replicas available for this SKU. + :vartype replicas: int + :ivar partitions: The maximum number of partitions available for this SKU. + :vartype partitions: int + """ + + indexes: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of indexes available for this SKU.""" + indexers: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of indexers available for this SKU.""" + partition_storage_in_gigabytes: Optional[float] = rest_field( + name="partitionStorageInGigabytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum storage size in Gigabytes available for this SKU per partition.""" + partition_vector_storage_in_gigabytes: Optional[float] = rest_field( + name="partitionVectorStorageInGigabytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum vector storage size in Gigabytes available for this SKU per partition.""" + search_units: Optional[int] = rest_field( + name="searchUnits", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum number of search units available for this SKU.""" + replicas: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of replicas available for this SKU.""" + partitions: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The maximum number of partitions available for this SKU.""" + + @overload + def __init__( + self, + *, + indexes: Optional[int] = None, + indexers: Optional[int] = None, + partition_storage_in_gigabytes: Optional[float] = None, + partition_vector_storage_in_gigabytes: Optional[float] = None, + search_units: Optional[int] = None, + replicas: Optional[int] = None, + partitions: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SkuOffering(_Model): + """Describes a SKU offering with its limits in a specific region. + + :ivar sku: The SKU definition. + :vartype sku: ~azure.mgmt.search.models.Sku + :ivar limits: The limits associated with this SKU offered in this region. + :vartype limits: ~azure.mgmt.search.models.SkuLimits + """ + + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU definition.""" + limits: Optional["_models.SkuLimits"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The limits associated with this SKU offered in this region.""" + + @overload + def __init__( + self, + *, + sku: Optional["_models.Sku"] = None, + limits: Optional["_models.SkuLimits"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.search.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.search.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserAssignedIdentity(_Model): + """User assigned identity properties. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of the assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client ID of the assigned identity.""" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py deleted file mode 100644 index b3ad67e748b3..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py +++ /dev/null @@ -1,2591 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# 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 -import datetime -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class AccessRule(_serialization.Model): - """Access rule in a network security perimeter configuration profile. - - :ivar name: Name of the access rule. - :vartype name: str - :ivar properties: Properties of Access Rule. - :vartype properties: ~azure.mgmt.search.models.AccessRuleProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "AccessRuleProperties"}, - } - - def __init__( - self, *, name: Optional[str] = None, properties: Optional["_models.AccessRuleProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword name: Name of the access rule. - :paramtype name: str - :keyword properties: Properties of Access Rule. - :paramtype properties: ~azure.mgmt.search.models.AccessRuleProperties - """ - super().__init__(**kwargs) - self.name = name - self.properties = properties - - -class AccessRuleProperties(_serialization.Model): - """Properties of Access Rule. - - :ivar direction: Direction of Access Rule. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.search.models.AccessRuleDirection - :ivar address_prefixes: Address prefixes in the CIDR format for inbound rules. - :vartype address_prefixes: list[str] - :ivar subscriptions: Subscriptions for inbound rules. - :vartype subscriptions: list[~azure.mgmt.search.models.AccessRulePropertiesSubscriptionsItem] - :ivar network_security_perimeters: Network security perimeters for inbound rules. - :vartype network_security_perimeters: list[~azure.mgmt.search.models.NetworkSecurityPerimeter] - :ivar fully_qualified_domain_names: Fully qualified domain names (FQDN) for outbound rules. - :vartype fully_qualified_domain_names: list[str] - :ivar email_addresses: Email addresses for outbound rules. - :vartype email_addresses: list[str] - :ivar phone_numbers: Phone numbers for outbound rules. - :vartype phone_numbers: list[str] - """ - - _attribute_map = { - "direction": {"key": "direction", "type": "str"}, - "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, - "subscriptions": {"key": "subscriptions", "type": "[AccessRulePropertiesSubscriptionsItem]"}, - "network_security_perimeters": {"key": "networkSecurityPerimeters", "type": "[NetworkSecurityPerimeter]"}, - "fully_qualified_domain_names": {"key": "fullyQualifiedDomainNames", "type": "[str]"}, - "email_addresses": {"key": "emailAddresses", "type": "[str]"}, - "phone_numbers": {"key": "phoneNumbers", "type": "[str]"}, - } - - def __init__( - self, - *, - direction: Optional[Union[str, "_models.AccessRuleDirection"]] = None, - address_prefixes: Optional[List[str]] = None, - subscriptions: Optional[List["_models.AccessRulePropertiesSubscriptionsItem"]] = None, - network_security_perimeters: Optional[List["_models.NetworkSecurityPerimeter"]] = None, - fully_qualified_domain_names: Optional[List[str]] = None, - email_addresses: Optional[List[str]] = None, - phone_numbers: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword direction: Direction of Access Rule. Known values are: "Inbound" and "Outbound". - :paramtype direction: str or ~azure.mgmt.search.models.AccessRuleDirection - :keyword address_prefixes: Address prefixes in the CIDR format for inbound rules. - :paramtype address_prefixes: list[str] - :keyword subscriptions: Subscriptions for inbound rules. - :paramtype subscriptions: list[~azure.mgmt.search.models.AccessRulePropertiesSubscriptionsItem] - :keyword network_security_perimeters: Network security perimeters for inbound rules. - :paramtype network_security_perimeters: - list[~azure.mgmt.search.models.NetworkSecurityPerimeter] - :keyword fully_qualified_domain_names: Fully qualified domain names (FQDN) for outbound rules. - :paramtype fully_qualified_domain_names: list[str] - :keyword email_addresses: Email addresses for outbound rules. - :paramtype email_addresses: list[str] - :keyword phone_numbers: Phone numbers for outbound rules. - :paramtype phone_numbers: list[str] - """ - super().__init__(**kwargs) - self.direction = direction - self.address_prefixes = address_prefixes - self.subscriptions = subscriptions - self.network_security_perimeters = network_security_perimeters - self.fully_qualified_domain_names = fully_qualified_domain_names - self.email_addresses = email_addresses - self.phone_numbers = phone_numbers - - -class AccessRulePropertiesSubscriptionsItem(_serialization.Model): - """Subscription identifiers. - - :ivar id: The fully qualified Azure resource ID of the subscription e.g. - ('/subscriptions/00000000-0000-0000-0000-000000000000'). - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The fully qualified Azure resource ID of the subscription e.g. - ('/subscriptions/00000000-0000-0000-0000-000000000000'). - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class AdminKeyResult(_serialization.Model): - """Response containing the primary and secondary admin API keys for a given Azure AI Search - service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar primary_key: The primary admin API key of the search service. - :vartype primary_key: str - :ivar secondary_key: The secondary admin API key of the search service. - :vartype secondary_key: str - """ - - _validation = { - "primary_key": {"readonly": True}, - "secondary_key": {"readonly": True}, - } - - _attribute_map = { - "primary_key": {"key": "primaryKey", "type": "str"}, - "secondary_key": {"key": "secondaryKey", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.primary_key: Optional[str] = None - self.secondary_key: Optional[str] = None - - -class AsyncOperationResult(_serialization.Model): - """The details of a long running asynchronous shared private link resource operation. - - :ivar status: The current status of the long running asynchronous shared private link resource - operation. Known values are: "Running", "Succeeded", and "Failed". - :vartype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceAsyncOperationResult - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - status: Optional[Union[str, "_models.SharedPrivateLinkResourceAsyncOperationResult"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: The current status of the long running asynchronous shared private link - resource operation. Known values are: "Running", "Succeeded", and "Failed". - :paramtype status: str or - ~azure.mgmt.search.models.SharedPrivateLinkResourceAsyncOperationResult - """ - super().__init__(**kwargs) - self.status = status - - -class CheckNameAvailabilityInput(_serialization.Model): - """Input of check name availability API. - - 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 name: The search service name to validate. Search service names must only contain - lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, - cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. - :vartype name: str - :ivar type: The type of the resource whose name is to be validated. This value must always be - 'searchServices'. Required. Default value is "searchServices". - :vartype type: str - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True, "constant": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - type = "searchServices" - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: The search service name to validate. Search service names must only contain - lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, - cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class CheckNameAvailabilityOutput(_serialization.Model): - """Output of check name availability API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar is_name_available: A value indicating whether the name is available. - :vartype is_name_available: bool - :ivar reason: The reason why the name is not available. 'Invalid' indicates the name provided - does not match the naming requirements (incorrect length, unsupported characters, etc.). - 'AlreadyExists' indicates that the name is already in use and is therefore unavailable. Known - values are: "Invalid" and "AlreadyExists". - :vartype reason: str or ~azure.mgmt.search.models.UnavailableNameReason - :ivar message: A message that explains why the name is invalid and provides resource naming - requirements. Available only if 'Invalid' is returned in the 'reason' property. - :vartype message: str - """ - - _validation = { - "is_name_available": {"readonly": True}, - "reason": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "is_name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.is_name_available: Optional[bool] = None - self.reason: Optional[Union[str, "_models.UnavailableNameReason"]] = None - self.message: Optional[str] = None - - -class CloudErrorBody(_serialization.Model): - """Describes a particular API error with an error code and a message. - - :ivar code: An error code that describes the error condition more precisely than an HTTP status - code. Can be used to programmatically handle specific error cases. - :vartype code: str - :ivar message: A message that describes the error in detail and provides debugging information. - :vartype message: str - :ivar target: The target of the particular error (for example, the name of the property in - error). - :vartype target: str - :ivar details: Contains nested errors that are related to this error. - :vartype details: list[~azure.mgmt.search.models.CloudErrorBody] - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[CloudErrorBody]"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - message: Optional[str] = None, - target: Optional[str] = None, - details: Optional[List["_models.CloudErrorBody"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: An error code that describes the error condition more precisely than an HTTP - status code. Can be used to programmatically handle specific error cases. - :paramtype code: str - :keyword message: A message that describes the error in detail and provides debugging - information. - :paramtype message: str - :keyword target: The target of the particular error (for example, the name of the property in - error). - :paramtype target: str - :keyword details: Contains nested errors that are related to this error. - :paramtype details: list[~azure.mgmt.search.models.CloudErrorBody] - """ - super().__init__(**kwargs) - self.code = code - self.message = message - self.target = target - self.details = details - - -class DataPlaneAadOrApiKeyAuthOption(_serialization.Model): - """Indicates that either the API key or an access token from a Microsoft Entra ID tenant can be - used for authentication. - - :ivar aad_auth_failure_mode: Describes what response the data plane API of a search service - would send for requests that failed authentication. Known values are: "http403" and - "http401WithBearerChallenge". - :vartype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode - """ - - _attribute_map = { - "aad_auth_failure_mode": {"key": "aadAuthFailureMode", "type": "str"}, - } - - def __init__( - self, *, aad_auth_failure_mode: Optional[Union[str, "_models.AadAuthFailureMode"]] = None, **kwargs: Any - ) -> None: - """ - :keyword aad_auth_failure_mode: Describes what response the data plane API of a search service - would send for requests that failed authentication. Known values are: "http403" and - "http401WithBearerChallenge". - :paramtype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode - """ - super().__init__(**kwargs) - self.aad_auth_failure_mode = aad_auth_failure_mode - - -class DataPlaneAuthOptions(_serialization.Model): - """Defines the options for how the search service authenticates a data plane request. This cannot - be set if 'disableLocalAuth' is set to true. - - :ivar api_key_only: Indicates that only the API key can be used for authentication. - :vartype api_key_only: JSON - :ivar aad_or_api_key: Indicates that either the API key or an access token from a Microsoft - Entra ID tenant can be used for authentication. - :vartype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption - """ - - _attribute_map = { - "api_key_only": {"key": "apiKeyOnly", "type": "object"}, - "aad_or_api_key": {"key": "aadOrApiKey", "type": "DataPlaneAadOrApiKeyAuthOption"}, - } - - def __init__( - self, - *, - api_key_only: Optional[JSON] = None, - aad_or_api_key: Optional["_models.DataPlaneAadOrApiKeyAuthOption"] = None, - **kwargs: Any - ) -> None: - """ - :keyword api_key_only: Indicates that only the API key can be used for authentication. - :paramtype api_key_only: JSON - :keyword aad_or_api_key: Indicates that either the API key or an access token from a Microsoft - Entra ID tenant can be used for authentication. - :paramtype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption - """ - super().__init__(**kwargs) - self.api_key_only = api_key_only - self.aad_or_api_key = aad_or_api_key - - -class EncryptionWithCmk(_serialization.Model): - """Describes a policy that determines how resources within the search service are to be encrypted - with customer managed keys. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar enforcement: Describes how a search service should enforce compliance if it finds objects - that aren't encrypted with the customer-managed key. Known values are: "Disabled", "Enabled", - and "Unspecified". - :vartype enforcement: str or ~azure.mgmt.search.models.SearchEncryptionWithCmk - :ivar encryption_compliance_status: Returns the status of search service compliance with - respect to non-CMK-encrypted objects. If a service has more than one unencrypted object, and - enforcement is enabled, the service is marked as noncompliant. Known values are: "Compliant" - and "NonCompliant". - :vartype encryption_compliance_status: str or - ~azure.mgmt.search.models.SearchEncryptionComplianceStatus - """ - - _validation = { - "encryption_compliance_status": {"readonly": True}, - } - - _attribute_map = { - "enforcement": {"key": "enforcement", "type": "str"}, - "encryption_compliance_status": {"key": "encryptionComplianceStatus", "type": "str"}, - } - - def __init__( - self, *, enforcement: Optional[Union[str, "_models.SearchEncryptionWithCmk"]] = None, **kwargs: Any - ) -> None: - """ - :keyword enforcement: Describes how a search service should enforce compliance if it finds - objects that aren't encrypted with the customer-managed key. Known values are: "Disabled", - "Enabled", and "Unspecified". - :paramtype enforcement: str or ~azure.mgmt.search.models.SearchEncryptionWithCmk - """ - super().__init__(**kwargs) - self.enforcement = enforcement - self.encryption_compliance_status: Optional[Union[str, "_models.SearchEncryptionComplianceStatus"]] = None - - -class Identity(_serialization.Model): - """Details about the search service identity. A null value indicates that the search service has - no identity assigned. - - 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 principal_id: The principal ID of the system-assigned identity of the search service. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system-assigned identity of the search service. - :vartype tenant_id: str - :ivar type: The type of identity used for the resource. The type 'SystemAssigned, UserAssigned' - includes both an identity created by the system and a set of user assigned identities. The type - 'None' will remove all identities from the service. Required. Known values are: "None", - "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". - :vartype type: str or ~azure.mgmt.search.models.IdentityType - :ivar user_assigned_identities: The list of user 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}'. - :vartype user_assigned_identities: dict[str, ~azure.mgmt.search.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.IdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of identity used for the resource. The type 'SystemAssigned, - UserAssigned' includes both an identity created by the system and a set of user assigned - identities. The type 'None' will remove all identities from the service. Required. Known values - are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". - :paramtype type: str or ~azure.mgmt.search.models.IdentityType - :keyword user_assigned_identities: The list of user 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}'. - :paramtype user_assigned_identities: dict[str, ~azure.mgmt.search.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class IpRule(_serialization.Model): - """The IP restriction rule of the Azure AI Search service. - - :ivar value: Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in - CIDR format (eg., 123.1.2.3/24) to be allowed. - :vartype value: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: Value corresponding to a single IPv4 address (eg., 123.1.2.3) or an IP range in - CIDR format (eg., 123.1.2.3/24) to be allowed. - :paramtype value: str - """ - super().__init__(**kwargs) - self.value = value - - -class ListQueryKeysResult(_serialization.Model): - """Response containing the query API keys for a given Azure AI Search service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The query keys for the Azure AI Search service. - :vartype value: list[~azure.mgmt.search.models.QueryKey] - :ivar next_link: Request URL that can be used to query next page of query keys. Returned when - the total number of requested query keys exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[QueryKey]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.QueryKey"]] = None - self.next_link: Optional[str] = None - - -class NetworkRuleSet(_serialization.Model): - """Network specific rules that determine how the Azure AI Search service may be reached. - - :ivar ip_rules: A list of IP restriction rules that defines the inbound network(s) with - allowing access to the search service endpoint. At the meantime, all other public IP networks - are blocked by the firewall. These restriction rules are applied only when the - 'publicNetworkAccess' of the search service is 'enabled'; otherwise, traffic over public - interface is not allowed even with any public IP rules, and private endpoint connections would - be the exclusive access method. - :vartype ip_rules: list[~azure.mgmt.search.models.IpRule] - :ivar bypass: Possible origins of inbound traffic that can bypass the rules defined in the - 'ipRules' section. Known values are: "None" and "AzureServices". - :vartype bypass: str or ~azure.mgmt.search.models.SearchBypass - """ - - _attribute_map = { - "ip_rules": {"key": "ipRules", "type": "[IpRule]"}, - "bypass": {"key": "bypass", "type": "str"}, - } - - def __init__( - self, - *, - ip_rules: Optional[List["_models.IpRule"]] = None, - bypass: Optional[Union[str, "_models.SearchBypass"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword ip_rules: A list of IP restriction rules that defines the inbound network(s) with - allowing access to the search service endpoint. At the meantime, all other public IP networks - are blocked by the firewall. These restriction rules are applied only when the - 'publicNetworkAccess' of the search service is 'enabled'; otherwise, traffic over public - interface is not allowed even with any public IP rules, and private endpoint connections would - be the exclusive access method. - :paramtype ip_rules: list[~azure.mgmt.search.models.IpRule] - :keyword bypass: Possible origins of inbound traffic that can bypass the rules defined in the - 'ipRules' section. Known values are: "None" and "AzureServices". - :paramtype bypass: str or ~azure.mgmt.search.models.SearchBypass - """ - super().__init__(**kwargs) - self.ip_rules = ip_rules - self.bypass = bypass - - -class NetworkSecurityPerimeter(_serialization.Model): - """Information about a network security perimeter (NSP). - - :ivar id: Fully qualified Azure resource ID of the NSP resource. - :vartype id: str - :ivar perimeter_guid: Universal unique ID (UUID) of the network security perimeter. - :vartype perimeter_guid: str - :ivar location: Location of the network security perimeter. - :vartype location: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "perimeter_guid": {"key": "perimeterGuid", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - perimeter_guid: Optional[str] = None, - location: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: Fully qualified Azure resource ID of the NSP resource. - :paramtype id: str - :keyword perimeter_guid: Universal unique ID (UUID) of the network security perimeter. - :paramtype perimeter_guid: str - :keyword location: Location of the network security perimeter. - :paramtype location: str - """ - super().__init__(**kwargs) - self.id = id - self.perimeter_guid = perimeter_guid - self.location = location - - -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. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.system_data: Optional["_models.SystemData"] = 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. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - """ - - -class NetworkSecurityPerimeterConfiguration(ProxyResource): - """Network security perimeter (NSP) configuration 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. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - :ivar properties: Network security configuration properties. - :vartype properties: ~azure.mgmt.search.models.NetworkSecurityPerimeterConfigurationProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "NetworkSecurityPerimeterConfigurationProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Network security configuration properties. - :paramtype properties: - ~azure.mgmt.search.models.NetworkSecurityPerimeterConfigurationProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class NetworkSecurityPerimeterConfigurationListResult(_serialization.Model): # pylint: disable=name-too-long - """Result of a list NSP (network security perimeter) configurations request. - - :ivar value: Array of network security perimeter results. - :vartype value: list[~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration] - :ivar next_link: The link used to get the next page of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NetworkSecurityPerimeterConfiguration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.NetworkSecurityPerimeterConfiguration"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: Array of network security perimeter results. - :paramtype value: list[~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration] - :keyword next_link: The link used to get the next page of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NetworkSecurityPerimeterConfigurationProperties(_serialization.Model): # pylint: disable=name-too-long - """Network security configuration properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provisioning_state: Provisioning state of a network security perimeter configuration that - is being created or updated. Known values are: "Succeeded", "Creating", "Updating", "Deleting", - "Accepted", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.search.models.NetworkSecurityPerimeterConfigurationProvisioningState - :ivar provisioning_issues: List of provisioning issues, if any. - :vartype provisioning_issues: list[~azure.mgmt.search.models.ProvisioningIssue] - :ivar network_security_perimeter: Information about a network security perimeter (NSP). - :vartype network_security_perimeter: ~azure.mgmt.search.models.NetworkSecurityPerimeter - :ivar resource_association: Information about resource association. - :vartype resource_association: ~azure.mgmt.search.models.ResourceAssociation - :ivar profile: Network security perimeter configuration profile. - :vartype profile: ~azure.mgmt.search.models.NetworkSecurityProfile - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "provisioning_issues": {"readonly": True}, - } - - _attribute_map = { - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "provisioning_issues": {"key": "provisioningIssues", "type": "[ProvisioningIssue]"}, - "network_security_perimeter": {"key": "networkSecurityPerimeter", "type": "NetworkSecurityPerimeter"}, - "resource_association": {"key": "resourceAssociation", "type": "ResourceAssociation"}, - "profile": {"key": "profile", "type": "NetworkSecurityProfile"}, - } - - def __init__( - self, - *, - network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = None, - resource_association: Optional["_models.ResourceAssociation"] = None, - profile: Optional["_models.NetworkSecurityProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_security_perimeter: Information about a network security perimeter (NSP). - :paramtype network_security_perimeter: ~azure.mgmt.search.models.NetworkSecurityPerimeter - :keyword resource_association: Information about resource association. - :paramtype resource_association: ~azure.mgmt.search.models.ResourceAssociation - :keyword profile: Network security perimeter configuration profile. - :paramtype profile: ~azure.mgmt.search.models.NetworkSecurityProfile - """ - super().__init__(**kwargs) - self.provisioning_state: Optional[ - Union[str, "_models.NetworkSecurityPerimeterConfigurationProvisioningState"] - ] = None - self.provisioning_issues: Optional[List["_models.ProvisioningIssue"]] = None - self.network_security_perimeter = network_security_perimeter - self.resource_association = resource_association - self.profile = profile - - -class NetworkSecurityProfile(_serialization.Model): - """Network security perimeter configuration profile. - - :ivar name: Name of the profile. - :vartype name: str - :ivar access_rules_version: Current access rules version. - :vartype access_rules_version: int - :ivar access_rules: List of Access Rules. - :vartype access_rules: list[~azure.mgmt.search.models.AccessRule] - :ivar diagnostic_settings_version: Current diagnostic settings version. - :vartype diagnostic_settings_version: int - :ivar enabled_log_categories: List of log categories that are enabled. - :vartype enabled_log_categories: list[str] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_rules_version": {"key": "accessRulesVersion", "type": "int"}, - "access_rules": {"key": "accessRules", "type": "[AccessRule]"}, - "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.AccessRule"]] = None, - diagnostic_settings_version: Optional[int] = None, - enabled_log_categories: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the profile. - :paramtype name: str - :keyword access_rules_version: Current access rules version. - :paramtype access_rules_version: int - :keyword access_rules: List of Access Rules. - :paramtype access_rules: list[~azure.mgmt.search.models.AccessRule] - :keyword diagnostic_settings_version: Current diagnostic settings version. - :paramtype diagnostic_settings_version: int - :keyword enabled_log_categories: List of log categories that are enabled. - :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 Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.search.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.search.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.search.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.search.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.is_data_action: Optional[bool] = None - self.display = display - self.origin: Optional[Union[str, "_models.Origin"]] = None - self.action_type: Optional[Union[str, "_models.ActionType"]] = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider: Optional[str] = None - self.resource: Optional[str] = None - self.operation: Optional[str] = None - self.description: Optional[str] = None - - -class OperationListResult(_serialization.Model): - """The result of the request to list REST API operations. It contains a list of operations and a - URL to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of operations by Azure AI Search, some supported by the resource provider - and others by data plane APIs. - :vartype value: list[~azure.mgmt.search.models.Operation] - :ivar next_link: The URL to get the next set of operation list results, if any. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.Operation"]] = None - self.next_link: Optional[str] = None - - -class PrivateEndpointConnection(Resource): - """Describes an existing private endpoint connection to the Azure AI Search service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - :ivar properties: Describes the properties of an existing private endpoint connection to the - Azure AI Search service. - :vartype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Describes the properties of an existing private endpoint connection to the - Azure AI Search service. - :paramtype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """Response containing a list of private endpoint connections. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of private endpoint connections. - :vartype value: list[~azure.mgmt.search.models.PrivateEndpointConnection] - :ivar next_link: Request URL that can be used to query next page of private endpoint - connections. Returned when the total number of requested private endpoint connections exceed - maximum page size. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.PrivateEndpointConnection"]] = None - self.next_link: Optional[str] = None - - -class PrivateEndpointConnectionProperties(_serialization.Model): - """Describes the properties of an existing private endpoint connection to the search service. - - :ivar private_endpoint: The private endpoint resource from Microsoft.Network provider. - :vartype private_endpoint: - ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateEndpoint - :ivar private_link_service_connection_state: Describes the current state of an existing Azure - Private Link service connection to the private endpoint. - :vartype private_link_service_connection_state: - ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState - :ivar group_id: The group ID of the Azure resource for which the private link service is for. - :vartype group_id: str - :ivar provisioning_state: The provisioning state of the private link service connection. Valid - values are Updating, Deleting, Failed, Succeeded, Incomplete, or Canceled. Known values are: - "Updating", "Deleting", "Failed", "Succeeded", "Incomplete", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState - """ - - _attribute_map = { - "private_endpoint": {"key": "privateEndpoint", "type": "PrivateEndpointConnectionPropertiesPrivateEndpoint"}, - "private_link_service_connection_state": { - "key": "privateLinkServiceConnectionState", - "type": "PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState", - }, - "group_id": {"key": "groupId", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpointConnectionPropertiesPrivateEndpoint"] = None, - private_link_service_connection_state: Optional[ - "_models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState" - ] = None, - group_id: Optional[str] = None, - provisioning_state: Optional[Union[str, "_models.PrivateLinkServiceConnectionProvisioningState"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: The private endpoint resource from Microsoft.Network provider. - :paramtype private_endpoint: - ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateEndpoint - :keyword private_link_service_connection_state: Describes the current state of an existing - Azure Private Link service connection to the private endpoint. - :paramtype private_link_service_connection_state: - ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState - :keyword group_id: The group ID of the Azure resource for which the private link service is - for. - :paramtype group_id: str - :keyword provisioning_state: The provisioning state of the private link service connection. - Valid values are Updating, Deleting, Failed, Succeeded, Incomplete, or Canceled. Known values - are: "Updating", "Deleting", "Failed", "Succeeded", "Incomplete", and "Canceled". - :paramtype provisioning_state: str or - ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState - """ - super().__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.group_id = group_id - self.provisioning_state = provisioning_state - - -class PrivateEndpointConnectionPropertiesPrivateEndpoint(_serialization.Model): # pylint: disable=name-too-long - """The private endpoint resource from Microsoft.Network provider. - - :ivar id: The resource ID of the private endpoint resource from Microsoft.Network provider. - :vartype id: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } - - def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The resource ID of the private endpoint resource from Microsoft.Network provider. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState( - _serialization.Model -): # pylint: disable=name-too-long - """Describes the current state of an existing Azure Private Link service connection to the private - endpoint. - - :ivar status: Status of the the private link service connection. Valid values are Pending, - Approved, Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and - "Disconnected". - :vartype status: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionStatus - :ivar description: The description for the private link service connection state. - :vartype description: str - :ivar actions_required: A description of any extra actions that may be required. - :vartype actions_required: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, - } - - def __init__( - self, - *, - status: Optional[Union[str, "_models.PrivateLinkServiceConnectionStatus"]] = None, - description: Optional[str] = None, - actions_required: str = "None", - **kwargs: Any - ) -> None: - """ - :keyword status: Status of the the private link service connection. Valid values are Pending, - Approved, Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and - "Disconnected". - :paramtype status: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionStatus - :keyword description: The description for the private link service connection state. - :paramtype description: str - :keyword actions_required: A description of any extra actions that may be required. - :paramtype actions_required: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required - - -class PrivateLinkResource(Resource): - """Describes a supported private link resource for the Azure AI Search service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - :ivar properties: Describes the properties of a supported private link resource for the Azure - AI Search service. - :vartype properties: ~azure.mgmt.search.models.PrivateLinkResourceProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "properties": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.properties: Optional["_models.PrivateLinkResourceProperties"] = None - - -class PrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of a supported private link resource for the Azure AI Search service. - For a given API version, this represents the 'supported' groupIds when creating a shared - private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar group_id: The group ID of the private link resource. - :vartype group_id: str - :ivar required_members: The list of required members of the private link resource. - :vartype required_members: list[str] - :ivar required_zone_names: The list of required DNS zone names of the private link resource. - :vartype required_zone_names: list[str] - :ivar shareable_private_link_resource_types: The list of resources that are onboarded to - private link service, that are supported by Azure AI Search. - :vartype shareable_private_link_resource_types: - list[~azure.mgmt.search.models.ShareablePrivateLinkResourceType] - """ - - _validation = { - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, - "required_zone_names": {"readonly": True}, - "shareable_private_link_resource_types": {"readonly": True}, - } - - _attribute_map = { - "group_id": {"key": "groupId", "type": "str"}, - "required_members": {"key": "requiredMembers", "type": "[str]"}, - "required_zone_names": {"key": "requiredZoneNames", "type": "[str]"}, - "shareable_private_link_resource_types": { - "key": "shareablePrivateLinkResourceTypes", - "type": "[ShareablePrivateLinkResourceType]", - }, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.group_id: Optional[str] = None - self.required_members: Optional[List[str]] = None - self.required_zone_names: Optional[List[str]] = None - self.shareable_private_link_resource_types: Optional[List["_models.ShareablePrivateLinkResourceType"]] = None - - -class PrivateLinkResourcesResult(_serialization.Model): - """Response containing a list of supported Private Link Resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of supported Private Link Resources. - :vartype value: list[~azure.mgmt.search.models.PrivateLinkResource] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.PrivateLinkResource"]] = None - - -class ProvisioningIssue(_serialization.Model): - """Describes a provisioning issue for a network security perimeter configuration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the issue. - :vartype name: str - :ivar properties: Details of a provisioning issue for a network security perimeter (NSP) - configuration. Resource providers should generate separate provisioning issue elements for each - separate issue detected, and include a meaningful and distinctive description, as well as any - appropriate suggestedResourceIds and suggestedAccessRules. - :vartype properties: ~azure.mgmt.search.models.ProvisioningIssueProperties - """ - - _validation = { - "name": {"readonly": True}, - "properties": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "ProvisioningIssueProperties"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.properties: Optional["_models.ProvisioningIssueProperties"] = None - - -class ProvisioningIssueProperties(_serialization.Model): - """Details of a provisioning issue for a network security perimeter (NSP) configuration. Resource - providers should generate separate provisioning issue elements for each separate issue - detected, and include a meaningful and distinctive description, as well as any appropriate - suggestedResourceIds and suggestedAccessRules. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar issue_type: Type of issue. Known values are: "Unknown", - "ConfigurationPropagationFailure", "MissingPerimeterConfiguration", and - "MissingIdentityConfiguration". - :vartype issue_type: str or ~azure.mgmt.search.models.IssueType - :ivar severity: Severity of the issue. Known values are: "Warning" and "Error". - :vartype severity: str or ~azure.mgmt.search.models.Severity - :ivar description: Description of the issue. - :vartype description: str - :ivar suggested_resource_ids: Fully qualified resource IDs of suggested resources that can be - associated to the network security perimeter (NSP) to remediate the issue. - :vartype suggested_resource_ids: list[str] - :ivar suggested_access_rules: Access rules that can be added to the network security profile - (NSP) to remediate the issue. - :vartype suggested_access_rules: list[~azure.mgmt.search.models.AccessRule] - """ - - _validation = { - "issue_type": {"readonly": True}, - "severity": {"readonly": True}, - "description": {"readonly": True}, - "suggested_resource_ids": {"readonly": True}, - "suggested_access_rules": {"readonly": True}, - } - - _attribute_map = { - "issue_type": {"key": "issueType", "type": "str"}, - "severity": {"key": "severity", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "suggested_resource_ids": {"key": "suggestedResourceIds", "type": "[str]"}, - "suggested_access_rules": {"key": "suggestedAccessRules", "type": "[AccessRule]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.issue_type: Optional[Union[str, "_models.IssueType"]] = None - self.severity: Optional[Union[str, "_models.Severity"]] = None - self.description: Optional[str] = None - self.suggested_resource_ids: Optional[List[str]] = None - self.suggested_access_rules: Optional[List["_models.AccessRule"]] = None - - -class QueryKey(_serialization.Model): - """Describes an API key for a given Azure AI Search service that conveys read-only permissions on - the docs collection of an index. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the query API key. Query names are optional, but assigning a name can - help you remember how it's used. - :vartype name: str - :ivar key: The value of the query API key. - :vartype key: str - """ - - _validation = { - "name": {"readonly": True}, - "key": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "key": {"key": "key", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.key: Optional[str] = None - - -class QuotaUsageResult(_serialization.Model): - """Describes the quota usage for a particular SKU. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. - :vartype id: str - :ivar unit: The unit of measurement for the search SKU. - :vartype unit: str - :ivar current_value: The currently used up value for the particular search SKU. - :vartype current_value: int - :ivar limit: The quota limit for the particular search SKU. - :vartype limit: int - :ivar name: The name of the SKU supported by Azure AI Search. - :vartype name: ~azure.mgmt.search.models.QuotaUsageResultName - """ - - _validation = { - "name": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "unit": {"key": "unit", "type": "str"}, - "current_value": {"key": "currentValue", "type": "int"}, - "limit": {"key": "limit", "type": "int"}, - "name": {"key": "name", "type": "QuotaUsageResultName"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - unit: Optional[str] = None, - current_value: Optional[int] = None, - limit: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. - :paramtype id: str - :keyword unit: The unit of measurement for the search SKU. - :paramtype unit: str - :keyword current_value: The currently used up value for the particular search SKU. - :paramtype current_value: int - :keyword limit: The quota limit for the particular search SKU. - :paramtype limit: int - """ - super().__init__(**kwargs) - self.id = id - self.unit = unit - self.current_value = current_value - self.limit = limit - self.name: Optional["_models.QuotaUsageResultName"] = None - - -class QuotaUsageResultName(_serialization.Model): - """The name of the SKU supported by Azure AI Search. - - :ivar value: The SKU name supported by Azure AI Search. - :vartype value: str - :ivar localized_value: The localized string value for the SKU name. - :vartype localized_value: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "localized_value": {"key": "localizedValue", "type": "str"}, - } - - def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The SKU name supported by Azure AI Search. - :paramtype value: str - :keyword localized_value: The localized string value for the SKU name. - :paramtype localized_value: str - """ - super().__init__(**kwargs) - self.value = value - self.localized_value = localized_value - - -class QuotaUsagesListResult(_serialization.Model): - """Response containing the quota usage information for all the supported SKUs of Azure AI Search. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The quota usages for the SKUs supported by Azure AI Search. - :vartype value: list[~azure.mgmt.search.models.QuotaUsageResult] - :ivar next_link: Request URL that can be used to query next page of quota usages. Returned when - the total number of requested quota usages exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[QuotaUsageResult]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.QuotaUsageResult"]] = None - self.next_link: Optional[str] = None - - -class ResourceAssociation(_serialization.Model): - """Information about resource association. - - :ivar name: Name of the resource association. - :vartype name: str - :ivar access_mode: Access mode of the resource association. Known values are: "Enforced", - "Learning", and "Audit". - :vartype access_mode: str or ~azure.mgmt.search.models.ResourceAssociationAccessMode - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_mode": {"key": "accessMode", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - access_mode: Optional[Union[str, "_models.ResourceAssociationAccessMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the resource association. - :paramtype name: str - :keyword access_mode: Access mode of the resource association. Known values are: "Enforced", - "Learning", and "Audit". - :paramtype access_mode: str or ~azure.mgmt.search.models.ResourceAssociationAccessMode - """ - super().__init__(**kwargs) - self.name = name - self.access_mode = access_mode - - -class SearchManagementRequestOptions(_serialization.Model): - """Parameter group. - - :ivar client_request_id: A client-generated GUID value that identifies this request. If - specified, this will be included in response information as a way to track the request. - :vartype client_request_id: str - """ - - _attribute_map = { - "client_request_id": {"key": "clientRequestId", "type": "str"}, - } - - def __init__(self, *, client_request_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_request_id: A client-generated GUID value that identifies this request. If - specified, this will be included in response information as a way to track the request. - :paramtype client_request_id: str - """ - super().__init__(**kwargs) - self.client_request_id = client_request_id - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - 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. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class SearchService(TrackedResource): - """Describes an Azure AI Search service and its current state. - - 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. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar sku: The SKU of the search service, which determines price tier and capacity limits. This - property is required when creating a new search service. - :vartype sku: ~azure.mgmt.search.models.Sku - :ivar identity: The identity of the resource. - :vartype identity: ~azure.mgmt.search.models.Identity - :ivar replica_count: The number of replicas in the search service. If specified, it must be a - value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. - :vartype replica_count: int - :ivar partition_count: The number of partitions in the search service; if specified, it can be - 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' - services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. - :vartype partition_count: int - :ivar endpoint: The endpoint of the Azure AI Search service. - :vartype endpoint: str - :ivar hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable - up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the - maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' - or 'highDensity'. For all other SKUs, this value must be 'default'. Known values are: "default" - and "highDensity". - :vartype hosting_mode: str or ~azure.mgmt.search.models.HostingMode - :ivar compute_type: Configure this property to support the search service using either the - Default Compute or Azure Confidential Compute. Known values are: "default" and "confidential". - :vartype compute_type: str or ~azure.mgmt.search.models.ComputeType - :ivar public_network_access: This value can be set to 'enabled' to avoid breaking changes on - existing customer resources and templates. If set to 'disabled', traffic over public interface - is not allowed, and private endpoint connections would be the exclusive access method. Known - values are: "enabled", "disabled", and "securedByPerimeter". - :vartype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess - :ivar status: The status of the search service. Possible values include: 'running': The search - service is running and no provisioning operations are underway. 'provisioning': The search - service is being provisioned or scaled up or down. 'deleting': The search service is being - deleted. 'degraded': The search service is degraded. This can occur when the underlying search - units are not healthy. The search service is most likely operational, but performance might be - slow and some requests might be dropped. 'disabled': The search service is disabled. In this - state, the service will reject all API requests. 'error': The search service is in an error - state. 'stopped': The search service is in a subscription that's disabled. If your service is - in the degraded, disabled, or error states, it means the Azure AI Search team is actively - investigating the underlying issue. Dedicated services in these states are still chargeable - based on the number of search units provisioned. Known values are: "running", "provisioning", - "deleting", "degraded", "disabled", "error", and "stopped". - :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus - :ivar status_details: The details of the search service status. - :vartype status_details: str - :ivar provisioning_state: The state of the last provisioning operation performed on the search - service. Provisioning is an intermediate state that occurs while service capacity is being - established. After capacity is set up, provisioningState changes to either 'Succeeded' or - 'Failed'. Client applications can poll provisioning status (the recommended polling interval is - from 30 seconds to one minute) by using the Get Search Service operation to see when an - operation is completed. If you are using the free service, this value tends to come back as - 'Succeeded' directly in the call to Create search service. This is because the free service - uses capacity that is already set up. Known values are: "succeeded", "provisioning", and - "failed". - :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState - :ivar network_rule_set: Network specific rules that determine how the Azure AI Search service - may be reached. - :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet - :ivar data_exfiltration_protections: A list of data exfiltration scenarios that are explicitly - disallowed for the search service. Currently, the only supported value is 'All' to disable all - possible data export scenarios with more fine grained controls planned for the future. - :vartype data_exfiltration_protections: list[str or - ~azure.mgmt.search.models.SearchDataExfiltrationProtection] - :ivar encryption_with_cmk: Specifies any policy regarding encryption of resources (such as - indexes) using customer manager keys within a search service. - :vartype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk - :ivar disable_local_auth: When set to true, calls to the search service will not be permitted - to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' - are defined. - :vartype disable_local_auth: bool - :ivar auth_options: Defines the options for how the data plane API of a search service - authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. - :vartype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions - :ivar semantic_search: Sets options that control the availability of semantic search. This - configuration is only possible for certain Azure AI Search SKUs in certain locations. Known - values are: "disabled", "free", and "standard". - :vartype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch - :ivar private_endpoint_connections: The list of private endpoint connections to the Azure AI - Search service. - :vartype private_endpoint_connections: - list[~azure.mgmt.search.models.PrivateEndpointConnection] - :ivar shared_private_link_resources: The list of shared private link resources managed by the - Azure AI Search service. - :vartype shared_private_link_resources: - list[~azure.mgmt.search.models.SharedPrivateLinkResource] - :ivar e_tag: A system generated property representing the service's etag that can be for - optimistic concurrency control during updates. - :vartype e_tag: str - :ivar upgrade_available: Indicates if the search service has an upgrade available. Known values - are: "notAvailable" and "available". - :vartype upgrade_available: str or ~azure.mgmt.search.models.UpgradeAvailable - :ivar service_upgraded_at: The date and time the search service was last upgraded. This field - will be null until the service gets upgraded for the first time. - :vartype service_upgraded_at: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "replica_count": {"maximum": 12, "minimum": 1}, - "partition_count": {"maximum": 12, "minimum": 1}, - "status": {"readonly": True}, - "status_details": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, - "shared_private_link_resources": {"readonly": True}, - "e_tag": {"readonly": True}, - "service_upgraded_at": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "sku": {"key": "sku", "type": "Sku"}, - "identity": {"key": "identity", "type": "Identity"}, - "replica_count": {"key": "properties.replicaCount", "type": "int"}, - "partition_count": {"key": "properties.partitionCount", "type": "int"}, - "endpoint": {"key": "properties.endpoint", "type": "str"}, - "hosting_mode": {"key": "properties.hostingMode", "type": "str"}, - "compute_type": {"key": "properties.computeType", "type": "str"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "status_details": {"key": "properties.statusDetails", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "network_rule_set": {"key": "properties.networkRuleSet", "type": "NetworkRuleSet"}, - "data_exfiltration_protections": {"key": "properties.dataExfiltrationProtections", "type": "[str]"}, - "encryption_with_cmk": {"key": "properties.encryptionWithCmk", "type": "EncryptionWithCmk"}, - "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, - "auth_options": {"key": "properties.authOptions", "type": "DataPlaneAuthOptions"}, - "semantic_search": {"key": "properties.semanticSearch", "type": "str"}, - "private_endpoint_connections": { - "key": "properties.privateEndpointConnections", - "type": "[PrivateEndpointConnection]", - }, - "shared_private_link_resources": { - "key": "properties.sharedPrivateLinkResources", - "type": "[SharedPrivateLinkResource]", - }, - "e_tag": {"key": "properties.eTag", "type": "str"}, - "upgrade_available": {"key": "properties.upgradeAvailable", "type": "str"}, - "service_upgraded_at": {"key": "properties.serviceUpgradedAt", "type": "iso-8601"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - identity: Optional["_models.Identity"] = None, - replica_count: int = 1, - partition_count: int = 1, - endpoint: Optional[str] = None, - hosting_mode: Union[str, "_models.HostingMode"] = "default", - compute_type: Optional[Union[str, "_models.ComputeType"]] = None, - public_network_access: Union[str, "_models.PublicNetworkAccess"] = "enabled", - network_rule_set: Optional["_models.NetworkRuleSet"] = None, - data_exfiltration_protections: Optional[List[Union[str, "_models.SearchDataExfiltrationProtection"]]] = None, - encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, - disable_local_auth: Optional[bool] = None, - auth_options: Optional["_models.DataPlaneAuthOptions"] = None, - semantic_search: Optional[Union[str, "_models.SearchSemanticSearch"]] = None, - upgrade_available: Optional[Union[str, "_models.UpgradeAvailable"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword sku: The SKU of the search service, which determines price tier and capacity limits. - This property is required when creating a new search service. - :paramtype sku: ~azure.mgmt.search.models.Sku - :keyword identity: The identity of the resource. - :paramtype identity: ~azure.mgmt.search.models.Identity - :keyword replica_count: The number of replicas in the search service. If specified, it must be - a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic - SKU. - :paramtype replica_count: int - :keyword partition_count: The number of partitions in the search service; if specified, it can - be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For - 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 - and 3. - :paramtype partition_count: int - :keyword endpoint: The endpoint of the Azure AI Search service. - :paramtype endpoint: str - :keyword hosting_mode: Applicable only for the standard3 SKU. You can set this property to - enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than - the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either - 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Known values are: - "default" and "highDensity". - :paramtype hosting_mode: str or ~azure.mgmt.search.models.HostingMode - :keyword compute_type: Configure this property to support the search service using either the - Default Compute or Azure Confidential Compute. Known values are: "default" and "confidential". - :paramtype compute_type: str or ~azure.mgmt.search.models.ComputeType - :keyword public_network_access: This value can be set to 'enabled' to avoid breaking changes on - existing customer resources and templates. If set to 'disabled', traffic over public interface - is not allowed, and private endpoint connections would be the exclusive access method. Known - values are: "enabled", "disabled", and "securedByPerimeter". - :paramtype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess - :keyword network_rule_set: Network specific rules that determine how the Azure AI Search - service may be reached. - :paramtype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet - :keyword data_exfiltration_protections: A list of data exfiltration scenarios that are - explicitly disallowed for the search service. Currently, the only supported value is 'All' to - disable all possible data export scenarios with more fine grained controls planned for the - future. - :paramtype data_exfiltration_protections: list[str or - ~azure.mgmt.search.models.SearchDataExfiltrationProtection] - :keyword encryption_with_cmk: Specifies any policy regarding encryption of resources (such as - indexes) using customer manager keys within a search service. - :paramtype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk - :keyword disable_local_auth: When set to true, calls to the search service will not be - permitted to utilize API keys for authentication. This cannot be set to true if - 'dataPlaneAuthOptions' are defined. - :paramtype disable_local_auth: bool - :keyword auth_options: Defines the options for how the data plane API of a search service - authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. - :paramtype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions - :keyword semantic_search: Sets options that control the availability of semantic search. This - configuration is only possible for certain Azure AI Search SKUs in certain locations. Known - values are: "disabled", "free", and "standard". - :paramtype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch - :keyword upgrade_available: Indicates if the search service has an upgrade available. Known - values are: "notAvailable" and "available". - :paramtype upgrade_available: str or ~azure.mgmt.search.models.UpgradeAvailable - """ - super().__init__(tags=tags, location=location, **kwargs) - self.sku = sku - self.identity = identity - self.replica_count = replica_count - self.partition_count = partition_count - self.endpoint = endpoint - self.hosting_mode = hosting_mode - self.compute_type = compute_type - self.public_network_access = public_network_access - self.status: Optional[Union[str, "_models.SearchServiceStatus"]] = None - self.status_details: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.network_rule_set = network_rule_set - self.data_exfiltration_protections = data_exfiltration_protections - self.encryption_with_cmk = encryption_with_cmk - self.disable_local_auth = disable_local_auth - self.auth_options = auth_options - self.semantic_search = semantic_search - self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None - self.shared_private_link_resources: Optional[List["_models.SharedPrivateLinkResource"]] = None - self.e_tag: Optional[str] = None - self.upgrade_available = upgrade_available - self.service_upgraded_at: Optional[datetime.datetime] = None - - -class SearchServiceListResult(_serialization.Model): - """Response containing a list of Azure AI Search services. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of search services. - :vartype value: list[~azure.mgmt.search.models.SearchService] - :ivar next_link: Request URL that can be used to query next page of search services. Returned - when the total number of requested search services exceed maximum page size. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SearchService]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.SearchService"]] = None - self.next_link: Optional[str] = None - - -class SearchServiceUpdate(Resource): - """The parameters used to update an Azure AI Search service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - :ivar sku: The SKU of the search service, which determines price tier and capacity limits. This - property is required when creating a new search service. - :vartype sku: ~azure.mgmt.search.models.Sku - :ivar location: The geographic location of the resource. This must be one of the supported and - registered Azure geo regions (for example, West US, East US, Southeast Asia, and so forth). - This property is required when creating a new resource. - :vartype location: str - :ivar tags: Tags to help categorize the resource in the Azure portal. - :vartype tags: dict[str, str] - :ivar identity: Details about the search service identity. A null value indicates that the - search service has no identity assigned. - :vartype identity: ~azure.mgmt.search.models.Identity - :ivar replica_count: The number of replicas in the search service. If specified, it must be a - value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. - :vartype replica_count: int - :ivar partition_count: The number of partitions in the search service; if specified, it can be - 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' - services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. - :vartype partition_count: int - :ivar endpoint: The endpoint of the Azure AI Search service. - :vartype endpoint: str - :ivar hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable - up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the - maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' - or 'highDensity'. For all other SKUs, this value must be 'default'. Known values are: "default" - and "highDensity". - :vartype hosting_mode: str or ~azure.mgmt.search.models.HostingMode - :ivar compute_type: Configure this property to support the search service using either the - Default Compute or Azure Confidential Compute. Known values are: "default" and "confidential". - :vartype compute_type: str or ~azure.mgmt.search.models.ComputeType - :ivar public_network_access: This value can be set to 'enabled' to avoid breaking changes on - existing customer resources and templates. If set to 'disabled', traffic over public interface - is not allowed, and private endpoint connections would be the exclusive access method. Known - values are: "enabled", "disabled", and "securedByPerimeter". - :vartype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess - :ivar status: The status of the search service. Possible values include: 'running': The search - service is running and no provisioning operations are underway. 'provisioning': The search - service is being provisioned or scaled up or down. 'deleting': The search service is being - deleted. 'degraded': The search service is degraded. This can occur when the underlying search - units are not healthy. The search service is most likely operational, but performance might be - slow and some requests might be dropped. 'disabled': The search service is disabled. In this - state, the service will reject all API requests. 'error': The search service is in an error - state. 'stopped': The search service is in a subscription that's disabled. If your service is - in the degraded, disabled, or error states, it means the Azure AI Search team is actively - investigating the underlying issue. Dedicated services in these states are still chargeable - based on the number of search units provisioned. Known values are: "running", "provisioning", - "deleting", "degraded", "disabled", "error", and "stopped". - :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus - :ivar status_details: The details of the search service status. - :vartype status_details: str - :ivar provisioning_state: The state of the last provisioning operation performed on the search - service. Provisioning is an intermediate state that occurs while service capacity is being - established. After capacity is set up, provisioningState changes to either 'Succeeded' or - 'Failed'. Client applications can poll provisioning status (the recommended polling interval is - from 30 seconds to one minute) by using the Get Search Service operation to see when an - operation is completed. If you are using the free service, this value tends to come back as - 'Succeeded' directly in the call to Create search service. This is because the free service - uses capacity that is already set up. Known values are: "succeeded", "provisioning", and - "failed". - :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState - :ivar network_rule_set: Network specific rules that determine how the Azure AI Search service - may be reached. - :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet - :ivar data_exfiltration_protections: A list of data exfiltration scenarios that are explicitly - disallowed for the search service. Currently, the only supported value is 'All' to disable all - possible data export scenarios with more fine grained controls planned for the future. - :vartype data_exfiltration_protections: list[str or - ~azure.mgmt.search.models.SearchDataExfiltrationProtection] - :ivar encryption_with_cmk: Specifies any policy regarding encryption of resources (such as - indexes) using customer manager keys within a search service. - :vartype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk - :ivar disable_local_auth: When set to true, calls to the search service will not be permitted - to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' - are defined. - :vartype disable_local_auth: bool - :ivar auth_options: Defines the options for how the data plane API of a search service - authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. - :vartype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions - :ivar semantic_search: Sets options that control the availability of semantic search. This - configuration is only possible for certain Azure AI Search SKUs in certain locations. Known - values are: "disabled", "free", and "standard". - :vartype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch - :ivar private_endpoint_connections: The list of private endpoint connections to the Azure AI - Search service. - :vartype private_endpoint_connections: - list[~azure.mgmt.search.models.PrivateEndpointConnection] - :ivar shared_private_link_resources: The list of shared private link resources managed by the - Azure AI Search service. - :vartype shared_private_link_resources: - list[~azure.mgmt.search.models.SharedPrivateLinkResource] - :ivar e_tag: A system generated property representing the service's etag that can be for - optimistic concurrency control during updates. - :vartype e_tag: str - :ivar upgrade_available: Indicates if the search service has an upgrade available. Known values - are: "notAvailable" and "available". - :vartype upgrade_available: str or ~azure.mgmt.search.models.UpgradeAvailable - :ivar service_upgraded_at: The date and time the search service was last upgraded. This field - will be null until the service gets upgraded for the first time. - :vartype service_upgraded_at: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "replica_count": {"maximum": 12, "minimum": 1}, - "partition_count": {"maximum": 12, "minimum": 1}, - "status": {"readonly": True}, - "status_details": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, - "shared_private_link_resources": {"readonly": True}, - "e_tag": {"readonly": True}, - "service_upgraded_at": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "sku": {"key": "sku", "type": "Sku"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "Identity"}, - "replica_count": {"key": "properties.replicaCount", "type": "int"}, - "partition_count": {"key": "properties.partitionCount", "type": "int"}, - "endpoint": {"key": "properties.endpoint", "type": "str"}, - "hosting_mode": {"key": "properties.hostingMode", "type": "str"}, - "compute_type": {"key": "properties.computeType", "type": "str"}, - "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "status_details": {"key": "properties.statusDetails", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "network_rule_set": {"key": "properties.networkRuleSet", "type": "NetworkRuleSet"}, - "data_exfiltration_protections": {"key": "properties.dataExfiltrationProtections", "type": "[str]"}, - "encryption_with_cmk": {"key": "properties.encryptionWithCmk", "type": "EncryptionWithCmk"}, - "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, - "auth_options": {"key": "properties.authOptions", "type": "DataPlaneAuthOptions"}, - "semantic_search": {"key": "properties.semanticSearch", "type": "str"}, - "private_endpoint_connections": { - "key": "properties.privateEndpointConnections", - "type": "[PrivateEndpointConnection]", - }, - "shared_private_link_resources": { - "key": "properties.sharedPrivateLinkResources", - "type": "[SharedPrivateLinkResource]", - }, - "e_tag": {"key": "properties.eTag", "type": "str"}, - "upgrade_available": {"key": "properties.upgradeAvailable", "type": "str"}, - "service_upgraded_at": {"key": "properties.serviceUpgradedAt", "type": "iso-8601"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - sku: Optional["_models.Sku"] = None, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.Identity"] = None, - replica_count: int = 1, - partition_count: int = 1, - endpoint: Optional[str] = None, - hosting_mode: Union[str, "_models.HostingMode"] = "default", - compute_type: Optional[Union[str, "_models.ComputeType"]] = None, - public_network_access: Union[str, "_models.PublicNetworkAccess"] = "enabled", - network_rule_set: Optional["_models.NetworkRuleSet"] = None, - data_exfiltration_protections: Optional[List[Union[str, "_models.SearchDataExfiltrationProtection"]]] = None, - encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, - disable_local_auth: Optional[bool] = None, - auth_options: Optional["_models.DataPlaneAuthOptions"] = None, - semantic_search: Optional[Union[str, "_models.SearchSemanticSearch"]] = None, - upgrade_available: Optional[Union[str, "_models.UpgradeAvailable"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword sku: The SKU of the search service, which determines price tier and capacity limits. - This property is required when creating a new search service. - :paramtype sku: ~azure.mgmt.search.models.Sku - :keyword location: The geographic location of the resource. This must be one of the supported - and registered Azure geo regions (for example, West US, East US, Southeast Asia, and so forth). - This property is required when creating a new resource. - :paramtype location: str - :keyword tags: Tags to help categorize the resource in the Azure portal. - :paramtype tags: dict[str, str] - :keyword identity: Details about the search service identity. A null value indicates that the - search service has no identity assigned. - :paramtype identity: ~azure.mgmt.search.models.Identity - :keyword replica_count: The number of replicas in the search service. If specified, it must be - a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic - SKU. - :paramtype replica_count: int - :keyword partition_count: The number of partitions in the search service; if specified, it can - be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For - 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 - and 3. - :paramtype partition_count: int - :keyword endpoint: The endpoint of the Azure AI Search service. - :paramtype endpoint: str - :keyword hosting_mode: Applicable only for the standard3 SKU. You can set this property to - enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than - the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either - 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Known values are: - "default" and "highDensity". - :paramtype hosting_mode: str or ~azure.mgmt.search.models.HostingMode - :keyword compute_type: Configure this property to support the search service using either the - Default Compute or Azure Confidential Compute. Known values are: "default" and "confidential". - :paramtype compute_type: str or ~azure.mgmt.search.models.ComputeType - :keyword public_network_access: This value can be set to 'enabled' to avoid breaking changes on - existing customer resources and templates. If set to 'disabled', traffic over public interface - is not allowed, and private endpoint connections would be the exclusive access method. Known - values are: "enabled", "disabled", and "securedByPerimeter". - :paramtype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess - :keyword network_rule_set: Network specific rules that determine how the Azure AI Search - service may be reached. - :paramtype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet - :keyword data_exfiltration_protections: A list of data exfiltration scenarios that are - explicitly disallowed for the search service. Currently, the only supported value is 'All' to - disable all possible data export scenarios with more fine grained controls planned for the - future. - :paramtype data_exfiltration_protections: list[str or - ~azure.mgmt.search.models.SearchDataExfiltrationProtection] - :keyword encryption_with_cmk: Specifies any policy regarding encryption of resources (such as - indexes) using customer manager keys within a search service. - :paramtype encryption_with_cmk: ~azure.mgmt.search.models.EncryptionWithCmk - :keyword disable_local_auth: When set to true, calls to the search service will not be - permitted to utilize API keys for authentication. This cannot be set to true if - 'dataPlaneAuthOptions' are defined. - :paramtype disable_local_auth: bool - :keyword auth_options: Defines the options for how the data plane API of a search service - authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. - :paramtype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions - :keyword semantic_search: Sets options that control the availability of semantic search. This - configuration is only possible for certain Azure AI Search SKUs in certain locations. Known - values are: "disabled", "free", and "standard". - :paramtype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch - :keyword upgrade_available: Indicates if the search service has an upgrade available. Known - values are: "notAvailable" and "available". - :paramtype upgrade_available: str or ~azure.mgmt.search.models.UpgradeAvailable - """ - super().__init__(**kwargs) - self.sku = sku - self.location = location - self.tags = tags - self.identity = identity - self.replica_count = replica_count - self.partition_count = partition_count - self.endpoint = endpoint - self.hosting_mode = hosting_mode - self.compute_type = compute_type - self.public_network_access = public_network_access - self.status: Optional[Union[str, "_models.SearchServiceStatus"]] = None - self.status_details: Optional[str] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.network_rule_set = network_rule_set - self.data_exfiltration_protections = data_exfiltration_protections - self.encryption_with_cmk = encryption_with_cmk - self.disable_local_auth = disable_local_auth - self.auth_options = auth_options - self.semantic_search = semantic_search - self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None - self.shared_private_link_resources: Optional[List["_models.SharedPrivateLinkResource"]] = None - self.e_tag: Optional[str] = None - self.upgrade_available = upgrade_available - self.service_upgraded_at: Optional[datetime.datetime] = None - - -class ShareablePrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of a resource type that has been onboarded to private link service, - supported by Azure AI Search. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The resource provider type for the resource that has been onboarded to private link - service, supported by Azure AI Search. - :vartype type: str - :ivar group_id: The resource provider group id for the resource that has been onboarded to - private link service, supported by Azure AI Search. - :vartype group_id: str - :ivar description: The description of the resource type that has been onboarded to private link - service, supported by Azure AI Search. - :vartype description: str - """ - - _validation = { - "type": {"readonly": True}, - "group_id": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "group_id": {"key": "groupId", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.group_id: Optional[str] = None - self.description: Optional[str] = None - - -class ShareablePrivateLinkResourceType(_serialization.Model): - """Describes an resource type that has been onboarded to private link service, supported by Azure - AI Search. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the resource type that has been onboarded to private link service, - supported by Azure AI Search. - :vartype name: str - :ivar properties: Describes the properties of a resource type that has been onboarded to - private link service, supported by Azure AI Search. - :vartype properties: ~azure.mgmt.search.models.ShareablePrivateLinkResourceProperties - """ - - _validation = { - "name": {"readonly": True}, - "properties": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "ShareablePrivateLinkResourceProperties"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.properties: Optional["_models.ShareablePrivateLinkResourceProperties"] = None - - -class SharedPrivateLinkResource(Resource): - """Describes a shared private link resource managed by the Azure AI Search service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.search.models.SystemData - :ivar properties: Describes the properties of a shared private link resource managed by the - Azure AI Search service. - :vartype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "SharedPrivateLinkResourceProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.SharedPrivateLinkResourceProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Describes the properties of a shared private link resource managed by the - Azure AI Search service. - :paramtype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class SharedPrivateLinkResourceListResult(_serialization.Model): - """Response containing a list of shared private link resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of shared private link resources. - :vartype value: list[~azure.mgmt.search.models.SharedPrivateLinkResource] - :ivar next_link: The URL to get the next set of shared private link resources, if there are - any. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[SharedPrivateLinkResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The URL to get the next set of shared private link resources, if there are - any. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value: Optional[List["_models.SharedPrivateLinkResource"]] = None - self.next_link = next_link - - -class SharedPrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of an existing shared private link resource managed by the Azure AI - Search service. - - :ivar private_link_resource_id: The resource ID of the resource the shared private link - resource is for. - :vartype private_link_resource_id: str - :ivar group_id: The group ID from the provider of resource the shared private link resource is - for. - :vartype group_id: str - :ivar request_message: The message for requesting approval of the shared private link resource. - :vartype request_message: str - :ivar resource_region: Optional. Can be used to specify the Azure Resource Manager location of - the resource for which a shared private link is being created. This is only required for those - resources whose DNS configuration are regional (such as Azure Kubernetes Service). - :vartype resource_region: str - :ivar status: Status of the shared private link resource. Valid values are Pending, Approved, - Rejected or Disconnected. Known values are: "Pending", "Approved", "Rejected", and - "Disconnected". - :vartype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus - :ivar provisioning_state: The provisioning state of the shared private link resource. Valid - values are Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", - "Deleting", "Failed", "Succeeded", and "Incomplete". - :vartype provisioning_state: str or - ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState - """ - - _attribute_map = { - "private_link_resource_id": {"key": "privateLinkResourceId", "type": "str"}, - "group_id": {"key": "groupId", "type": "str"}, - "request_message": {"key": "requestMessage", "type": "str"}, - "resource_region": {"key": "resourceRegion", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - private_link_resource_id: Optional[str] = None, - group_id: Optional[str] = None, - request_message: Optional[str] = None, - resource_region: Optional[str] = None, - status: Optional[Union[str, "_models.SharedPrivateLinkResourceStatus"]] = None, - provisioning_state: Optional[Union[str, "_models.SharedPrivateLinkResourceProvisioningState"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_link_resource_id: The resource ID of the resource the shared private link - resource is for. - :paramtype private_link_resource_id: str - :keyword group_id: The group ID from the provider of resource the shared private link resource - is for. - :paramtype group_id: str - :keyword request_message: The message for requesting approval of the shared private link - resource. - :paramtype request_message: str - :keyword resource_region: Optional. Can be used to specify the Azure Resource Manager location - of the resource for which a shared private link is being created. This is only required for - those resources whose DNS configuration are regional (such as Azure Kubernetes Service). - :paramtype resource_region: str - :keyword status: Status of the shared private link resource. Valid values are Pending, - Approved, Rejected or Disconnected. Known values are: "Pending", "Approved", "Rejected", and - "Disconnected". - :paramtype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus - :keyword provisioning_state: The provisioning state of the shared private link resource. Valid - values are Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", - "Deleting", "Failed", "Succeeded", and "Incomplete". - :paramtype provisioning_state: str or - ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState - """ - super().__init__(**kwargs) - self.private_link_resource_id = private_link_resource_id - self.group_id = group_id - self.request_message = request_message - self.resource_region = resource_region - self.status = status - self.provisioning_state = provisioning_state - - -class Sku(_serialization.Model): - """Defines the SKU of a search service, which determines billing rate and capacity limits. - - :ivar name: The SKU of the search service. Valid values include: 'free': Shared service. - 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 - partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search - unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or - up to 3 partitions with more indexes if you also set the hostingMode property to - 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. - 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. Known values are: - "free", "basic", "standard", "standard2", "standard3", "storage_optimized_l1", and - "storage_optimized_l2". - :vartype name: str or ~azure.mgmt.search.models.SkuName - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs: Any) -> None: - """ - :keyword name: The SKU of the search service. Valid values include: 'free': Shared service. - 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 - partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search - unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or - up to 3 partitions with more indexes if you also set the hostingMode property to - 'highDensity'). 'storage_optimized_l1': Supports 1TB per partition, up to 12 partitions. - 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. Known values are: - "free", "basic", "standard", "standard2", "standard3", "storage_optimized_l1", and - "storage_optimized_l2". - :paramtype name: str or ~azure.mgmt.search.models.SkuName - """ - super().__init__(**kwargs) - self.name = name - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.search.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.search.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.search.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.search.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_patch.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_patch.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py index 209140865c02..ef48e827d5f3 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/__init__.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,32 +12,33 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import +from ._operations import OfferingsOperations # type: ignore from ._operations import Operations # type: ignore -from ._admin_keys_operations import AdminKeysOperations # type: ignore -from ._query_keys_operations import QueryKeysOperations # type: ignore -from ._services_operations import ServicesOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations # type: ignore -from ._usages_operations import UsagesOperations # type: ignore -from ._search_management_client_operations import SearchManagementClientOperationsMixin # type: ignore -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import SharedPrivateLinkResourcesOperations # type: ignore +from ._operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import ServicesOperations # type: ignore +from ._operations import UsagesOperations # type: ignore +from ._operations import AdminKeysOperations # type: ignore +from ._operations import QueryKeysOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import _SearchManagementClientOperationsMixin # type: ignore # pylint: disable=unused-import from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "OfferingsOperations", "Operations", - "AdminKeysOperations", - "QueryKeysOperations", - "ServicesOperations", - "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", "SharedPrivateLinkResourcesOperations", - "UsagesOperations", - "SearchManagementClientOperationsMixin", "NetworkSecurityPerimeterConfigurationsOperations", + "ServicesOperations", + "UsagesOperations", + "AdminKeysOperations", + "QueryKeysOperations", + "PrivateLinkResourcesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py deleted file mode 100644 index fac68357d0f6..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_admin_keys_operations.py +++ /dev/null @@ -1,289 +0,0 @@ -# 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 typing import Any, Callable, Dict, Optional, TypeVar, Union - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 SearchManagementClientConfiguration -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_get_request( - resource_group_name: str, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_request( - resource_group_name: str, - search_service_name: str, - key_kind: Union[str, _models.AdminKeyKind], - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "keyKind": _SERIALIZER.url("key_kind", key_kind, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AdminKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`admin_keys` 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: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.AdminKeyResult: - """Gets the primary and secondary admin API keys for the specified Azure AI Search service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: AdminKeyResult or the result of cls(response) - :rtype: ~azure.mgmt.search.models.AdminKeyResult - :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.AdminKeyResult] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AdminKeyResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def regenerate( - self, - resource_group_name: str, - search_service_name: str, - key_kind: Union[str, _models.AdminKeyKind], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.AdminKeyResult: - """Regenerates either the primary or secondary admin API key. You can only regenerate one key at a - time. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param key_kind: Specifies which key to regenerate. Valid values include 'primary' and - 'secondary'. Known values are: "primary" and "secondary". Required. - :type key_kind: str or ~azure.mgmt.search.models.AdminKeyKind - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: AdminKeyResult or the result of cls(response) - :rtype: ~azure.mgmt.search.models.AdminKeyResult - :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.AdminKeyResult] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_regenerate_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - key_kind=key_kind, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AdminKeyResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_network_security_perimeter_configurations_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_network_security_perimeter_configurations_operations.py deleted file mode 100644 index 7918ee134629..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_network_security_perimeter_configurations_operations.py +++ /dev/null @@ -1,440 +0,0 @@ -# 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 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, - 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 SearchManagementClientConfiguration -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_list_by_service_request( - resource_group_name: str, search_service_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-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, search_service_name: str, nsp_config_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-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations/{nspConfigName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "nspConfigName": _SERIALIZER.url( - "nsp_config_name", - nsp_config_name, - "str", - max_length=100, - min_length=38, - pattern=r"^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\.[a-z][a-z0-9]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_reconcile_request( - resource_group_name: str, search_service_name: str, nsp_config_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-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations/{nspConfigName}/reconcile", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "nspConfigName": _SERIALIZER.url( - "nsp_config_name", - nsp_config_name, - "str", - max_length=100, - min_length=38, - pattern=r"^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}\.[a-z][a-z0-9]*$", - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`network_security_perimeter_configurations` 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: SearchManagementClientConfiguration = 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_by_service( - self, resource_group_name: str, search_service_name: str, **kwargs: Any - ) -> Iterable["_models.NetworkSecurityPerimeterConfiguration"]: - """Gets a list of network security perimeter configurations for a search service. - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration] - :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.NetworkSecurityPerimeterConfigurationListResult] = 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_by_service_request( - resource_group_name=resource_group_name, - search_service_name=search_service_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("NetworkSecurityPerimeterConfigurationListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any - ) -> _models.NetworkSecurityPerimeterConfiguration: - """Gets a network security perimeter configuration. - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param nsp_config_name: The network security perimeter configuration name. Required. - :type nsp_config_name: str - :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration - :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.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - nsp_config_name=nsp_config_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _reconcile_initial( - self, resource_group_name: str, search_service_name: str, nsp_config_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_reconcile_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - nsp_config_name=nsp_config_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]: - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_reconcile( - self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Reconcile network security perimeter configuration for the Azure AI Search resource provider. - This triggers a manual resync with network security perimeter configurations by ensuring the - search service carries the latest configuration. - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param nsp_config_name: The network security perimeter configuration name. Required. - :type nsp_config_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._reconcile_initial( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - nsp_config_name=nsp_config_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 diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py index 8889276054b3..94eb0efa70f5 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_operations.py @@ -1,12 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -16,35 +19,44 @@ 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 SearchManagementClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._utils.utils import ClientMixinABC +from .._validation import api_version_validation T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_offerings_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", "2025-05-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Search/operations") + _url = "/providers/Microsoft.Search/offerings" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -55,6 +67,916 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_operations_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Search/operations" + + # 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_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_update_request( # pylint: disable=name-too-long + resource_group_name: str, + search_service_name: str, + private_endpoint_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_list_by_service_request( # pylint: disable=name-too-long + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_private_link_resources_get_request( # pylint: disable=name-too-long + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_private_link_resources_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_private_link_resources_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_shared_private_link_resources_list_by_service_request( # pylint: disable=name-too-long + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_security_perimeter_configurations_get_request( # pylint: disable=name-too-long + resource_group_name: str, search_service_name: str, nsp_config_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations/{nspConfigName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "nspConfigName": _SERIALIZER.url("nsp_config_name", nsp_config_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_security_perimeter_configurations_list_by_service_request( # pylint: disable=name-too-long + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_network_security_perimeter_configurations_reconcile_request( # pylint: disable=name-too-long + resource_group_name: str, search_service_name: str, nsp_config_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations/{nspConfigName}/reconcile" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "nspConfigName": _SERIALIZER.url("nsp_config_name", nsp_config_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_services_check_name_availability_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_services_get_request( + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_services_create_or_update_request( + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_services_update_request( + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_services_delete_request( + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_services_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_services_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_services_upgrade_request( + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/upgrade" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_usages_list_by_subscription_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_admin_keys_get_request( + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_admin_keys_regenerate_request( + resource_group_name: str, + search_service_name: str, + key_kind: Union[str, _models.AdminKeyKind], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "keyKind": _SERIALIZER.url("key_kind", key_kind, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_query_keys_create_request( + resource_group_name: str, search_service_name: str, name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "name": _SERIALIZER.url("name", name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_query_keys_list_by_search_service_request( # pylint: disable=name-too-long + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_query_keys_delete_request( + resource_group_name: str, search_service_name: str, key: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "key": _SERIALIZER.url("key", key, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_link_resources_list_supported_request( # pylint: disable=name-too-long + resource_group_name: str, search_service_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_search_management_usage_by_subscription_sku_request( # pylint: disable=name-too-long + location: str, sku_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class OfferingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`offerings` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + @api_version_validation( + method_added_on="2026-03-01-preview", + params_added_on={"2026-03-01-preview": ["api_version", "accept"]}, + api_versions_list=["2026-03-01-preview"], + ) + def list(self, **kwargs: Any) -> _models.OfferingsListResult: + """Lists all of the features and SKUs offered by the Azure AI Search service in each region. Note: + This API returns a non-ARM resource collection and is not RPC-compliant. It will be replaced + with an action-style API in the next preview as a breaking change. Customers should avoid + taking new dependencies on the current shape. + + :return: OfferingsListResult. The OfferingsListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.OfferingsListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.OfferingsListResult] = kwargs.pop("cls", None) + + _request = build_offerings_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.OfferingsListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + class Operations: """ .. warning:: @@ -62,12 +984,2825 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`operations` attribute. + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """Lists all of the available REST API operations of the Microsoft.Search provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, search_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets the details of the private endpoint connection to the search service in the given resource + group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. Required. + :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. Required. + :type private_endpoint_connection: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. Required. + :type private_endpoint_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: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + search_service_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates a private endpoint connection to the search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The definition of the private endpoint connection to + update. Is one of the following types: PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection or JSON + or IO[bytes] + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection + else: + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( + self, resource_group_name: str, search_service_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Optional[_models.PrivateEndpointConnection]: + """Disconnects the private endpoint connection and deletes it from the search service. Returns 200 + (OK) with the deleted connection details on successful deletion, or 404 (Not Found) if the + connection does not exist. NOTE: The behavior of returning 404 is inconsistent with ARM + guidelines. Clients should expect a 204 response in future versions and avoid new dependencies + on the 404 response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection to the + Azure AI Search service with the specified resource group. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection or None. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection or None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_service( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """Gets a list of all private endpoint connections in the given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = 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_private_endpoint_connections_list_by_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateEndpointConnection], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class SharedPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`shared_private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, search_service_name: str, shared_private_link_resource_name: str, **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Gets the details of the shared private link resource managed by the search service in the given + resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :return: SharedPrivateLinkResource. The SharedPrivateLinkResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_shared_private_link_resources_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SharedPrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(shared_private_link_resource, (IOBase, bytes)): + _content = shared_private_link_resource + else: + _content = json.dumps(shared_private_link_resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_shared_private_link_resources_create_or_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: _models.SharedPrivateLinkResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource + :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 SharedPrivateLinkResource. The + SharedPrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SharedPrivateLinkResource. The + SharedPrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SharedPrivateLinkResource. The + SharedPrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Is one of the following types: SharedPrivateLinkResource, JSON, IO[bytes] + Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource or JSON + or IO[bytes] + :return: An instance of LROPoller that returns SharedPrivateLinkResource. The + SharedPrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedPrivateLinkResource] = 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, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + shared_private_link_resource=shared_private_link_resource, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SharedPrivateLinkResource, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SharedPrivateLinkResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SharedPrivateLinkResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, search_service_name: str, shared_private_link_resource_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_shared_private_link_resources_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 404]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, search_service_name: str, shared_private_link_resource_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Initiates the deletion of the shared private link resource from the search service. Returns 202 + (Accepted) for asynchronous deletion, 204 (No Content) if the service exists but the shared + private link is not found, or 404 (Not Found) if the service is not found. NOTE: The behavior + of returning 404 is inconsistent with ARM guidelines. Clients should expect a 204 response in + future versions and avoid new dependencies on the 404 response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param shared_private_link_resource_name: The name of the shared private link resource managed + by the Azure AI Search service within the specified resource group. Required. + :type shared_private_link_resource_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_service( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.SharedPrivateLinkResource"]: + """Gets a list of all shared private link resources managed by the given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of SharedPrivateLinkResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SharedPrivateLinkResource]] = 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_shared_private_link_resources_list_by_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SharedPrivateLinkResource], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`network_security_perimeter_configurations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets a network security perimeter configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param nsp_config_name: The network security perimeter configuration name. Required. + :type nsp_config_name: str + :return: NetworkSecurityPerimeterConfiguration. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + nsp_config_name=nsp_config_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_service( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.NetworkSecurityPerimeterConfiguration"]: + """Gets a list of network security perimeter configurations for a search service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = 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_network_security_perimeter_configurations_list_by_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.NetworkSecurityPerimeterConfiguration], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _reconcile_initial( + self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_reconcile_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + nsp_config_name=nsp_config_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reconcile( + self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Reconcile network security perimeter configuration for the Azure AI Search resource provider. + This triggers a manual resync with network security perimeter configurations by ensuring the + search service carries the latest configuration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param nsp_config_name: The network security perimeter configuration name. Required. + :type nsp_config_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._reconcile_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + nsp_config_name=nsp_config_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def check_name_availability( + self, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://.search.windows.net). + + :param check_name_availability_input: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.search.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, check_name_availability_input: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://.search.windows.net). + + :param check_name_availability_input: The request body. Required. + :type check_name_availability_input: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://.search.windows.net). + + :param check_name_availability_input: The request body. Required. + :type check_name_availability_input: 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: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, JSON, IO[bytes]], **kwargs: Any + ) -> _models.CheckNameAvailabilityOutput: + """Checks whether or not the given search service name is available for use. Search service names + must be globally unique since they are part of the service URI + (https://.search.windows.net). + + :param check_name_availability_input: The request body. Is one of the following types: + CheckNameAvailabilityInput, JSON, IO[bytes] Required. + :type check_name_availability_input: ~azure.mgmt.search.models.CheckNameAvailabilityInput or + JSON or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_services_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, search_service_name: str, **kwargs: Any) -> _models.SearchService: + """Gets the search service with the given name in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) + + _request = build_services_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SearchService, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + service: Union[_models.SearchService, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(service, (IOBase, bytes)): + _content = service + else: + _content = json.dumps(service, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_services_create_or_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: _models.SearchService, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SearchService]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to create or update. Create applies to + both serverless and dedicated search services; update applies only to dedicated search + services. Required. + :type service: ~azure.mgmt.search.models.SearchService + :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 SearchService. The SearchService is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SearchService]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to create or update. Create applies to + both serverless and dedicated search services; update applies only to dedicated search + services. Required. + :type service: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SearchService. The SearchService is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SearchService]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to create or update. Create applies to + both serverless and dedicated search services; update applies only to dedicated search + services. Required. + :type service: 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 SearchService. The SearchService is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + service: Union[_models.SearchService, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SearchService]: + """Creates or updates a search service in the given resource group. If the search service already + exists, all properties will be updated with the given values. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to create or update. Create applies to + both serverless and dedicated search services; update applies only to dedicated search + services. Is one of the following types: SearchService, JSON, IO[bytes] Required. + :type service: ~azure.mgmt.search.models.SearchService or JSON or IO[bytes] + :return: An instance of LROPoller that returns SearchService. The SearchService is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = 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, + search_service_name=search_service_name, + service=service, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SearchService, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SearchService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SearchService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + search_service_name: str, + service: _models.SearchServiceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SearchService: + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to update. Required. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + search_service_name: str, + service: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SearchService: + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to update. Required. + :type service: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + search_service_name: str, + service: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SearchService: + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to update. Required. + :type service: 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: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + search_service_name: str, + service: Union[_models.SearchServiceUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.SearchService: + """Updates an existing search service in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param service: The definition of the search service to update. Is one of the following types: + SearchServiceUpdate, JSON, IO[bytes] Required. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate or JSON or IO[bytes] + :return: SearchService. The SearchService is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.SearchService + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(service, (IOBase, bytes)): + _content = service + else: + _content = json.dumps(service, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_services_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SearchService, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> None: + """Deletes a search service in the given resource group, along with its associated resources. + Returns 200 (OK) on successful deletion, or 204 (No Content) if the service is not found. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_services_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.SearchService"]: + """Gets a list of all search services in the given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of SearchService + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SearchService]] = 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_services_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SearchService], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.SearchService"]: + """Gets a list of all search services in the given subscription. + + :return: An iterator like instance of SearchService + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SearchService]] = 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_services_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SearchService], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _upgrade_initial(self, resource_group_name: str, search_service_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_services_upgrade_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_upgrade( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> LROPoller[_models.SearchService]: + """Upgrades the Azure AI Search service to the latest version available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An instance of LROPoller that returns SearchService. The SearchService is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SearchService] = 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._upgrade_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.SearchService, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SearchService].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SearchService]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`usages` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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_by_subscription(self, location: str, **kwargs: Any) -> ItemPaged["_models.QuotaUsageResult"]: + """Get a list of all Azure AI Search quota usages across the subscription. + + :param location: The name of the Azure region. Required. + :type location: str + :return: An iterator like instance of QuotaUsageResult + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.QuotaUsageResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.QuotaUsageResult]] = 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_usages_list_by_subscription_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.QuotaUsageResult], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class AdminKeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`admin_keys` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, search_service_name: str, **kwargs: Any) -> _models.AdminKeyResult: + """Gets the primary and secondary admin API keys for the specified Azure AI Search service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: AdminKeyResult. The AdminKeyResult is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.AdminKeyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) + + _request = build_admin_keys_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AdminKeyResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def regenerate( + self, + resource_group_name: str, + search_service_name: str, + key_kind: Union[str, _models.AdminKeyKind], + **kwargs: Any + ) -> _models.AdminKeyResult: + """Regenerates either the primary or secondary admin API key. You can only regenerate one key at a + time. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param key_kind: Specifies which key to regenerate. Valid values include 'primary' and + 'secondary'. Known values are: "primary" and "secondary". Required. + :type key_kind: str or ~azure.mgmt.search.models.AdminKeyKind + :return: AdminKeyResult. The AdminKeyResult is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.AdminKeyResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) + + _request = build_admin_keys_regenerate_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + key_kind=key_kind, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.AdminKeyResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class QueryKeysOperations: """ + .. warning:: + **DO NOT** instantiate this class directly. - models = _models + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`query_keys` attribute. + """ - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") self._config: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") @@ -75,18 +3810,287 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """Lists all of the available REST API operations of the Microsoft.Search provider. + def create(self, resource_group_name: str, search_service_name: str, name: str, **kwargs: Any) -> _models.QueryKey: + """Generates a new query key for the specified search service. You can create up to 50 query keys + per service. - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.Operation] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param name: The name of the new query API key. Required. + :type name: str + :return: QueryKey. The QueryKey is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.QueryKey + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.QueryKey] = kwargs.pop("cls", None) + + _request = build_query_keys_create_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.QueryKey, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_search_service( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.QueryKey"]: + """Returns the list of query API keys for the given Azure AI Search service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of QueryKey + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.QueryKey] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.QueryKey]] = 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_query_keys_list_by_search_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.QueryKey], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, search_service_name: str, key: str, **kwargs: Any + ) -> None: + """Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process + for regenerating a query key is to delete and then recreate it. Returns 200 (OK) on successful + deletion, 204 (No Content) if the service exists but the query keys not found, or 404 (Not + Found) if the service is not found. NOTE: The behavior of returning 404 is inconsistent with + ARM guidelines. Clients should expect a 204 response in future versions and avoid new + dependencies on the 404 response. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :param key: The query key to be deleted. Query keys are identified by value, not by name. + Required. + :type key: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_query_keys_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + key=key, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SearchManagementClientConfiguration = 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_supported( + self, resource_group_name: str, search_service_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateLinkResource"]: + """Gets a list of all supported private link resource types for the given service. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param search_service_name: The name of the Azure AI Search service associated with the + specified resource group. Required. + :type search_service_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.PrivateLinkResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -99,12 +4103,20 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_private_link_resources_list_supported_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -119,16 +4131,24 @@ def prepare_request(next_link=None): _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" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.PrivateLinkResource], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -141,8 +4161,86 @@ def get_next(next_link=None): if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + +class _SearchManagementClientOperationsMixin( + ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], SearchManagementClientConfiguration] +): + + @distributed_trace + def usage_by_subscription_sku(self, location: str, sku_name: str, **kwargs: Any) -> _models.QuotaUsageResult: + """Gets the quota usage for a search SKU in the given subscription. + + :param location: The name of the Azure region. Required. + :type location: str + :param sku_name: The unique SKU name that identifies a billable tier. Required. + :type sku_name: str + :return: QuotaUsageResult. The QuotaUsageResult is compatible with MutableMapping + :rtype: ~azure.mgmt.search.models.QuotaUsageResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.QuotaUsageResult] = kwargs.pop("cls", None) + + _request = build_search_management_usage_by_subscription_sku_request( + location=location, + sku_name=sku_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.CloudError, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.QuotaUsageResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_patch.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_patch.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 71feb3a8165d..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,665 +0,0 @@ -# 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 SearchManagementClientConfiguration -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_update_request( - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-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.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - 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_get_request( - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "privateEndpointConnectionName": _SERIALIZER.url( - "private_endpoint_connection_name", private_endpoint_connection_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_service_request( - resource_group_name: str, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`private_endpoint_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: SearchManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def update( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The definition of the private endpoint connection to - update. Required. - :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The definition of the private endpoint connection to - update. Required. - :type private_endpoint_connection: IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The definition of the private endpoint connection to - update. Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection or - IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = 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.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_update_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets the details of the private endpoint connection to the search service in the given resource - group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = 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.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( - self, - resource_group_name: str, - search_service_name: str, - private_endpoint_connection_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> Optional[_models.PrivateEndpointConnection]: - """Disconnects the private endpoint connection and deletes it from the search service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection to the - Azure AI Search service with the specified resource group. Required. - :type private_endpoint_connection_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: PrivateEndpointConnection or None or the result of cls(response) - :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection or 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[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_delete_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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, 404]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_service( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnection"]: - """Gets a list of all private endpoint connections in the given service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.PrivateEndpointConnection] - :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.PrivateEndpointConnectionListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_service_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("PrivateEndpointConnectionListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py deleted file mode 100644 index b87b7e77d687..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,195 +0,0 @@ -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -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 SearchManagementClientConfiguration -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_list_supported_request( - resource_group_name: str, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`private_link_resources` 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: SearchManagementClientConfiguration = 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_supported( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> Iterable["_models.PrivateLinkResource"]: - """Gets a list of all supported private link resource types for the given service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.PrivateLinkResource] - :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.PrivateLinkResourcesResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_supported_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("PrivateLinkResourcesResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py deleted file mode 100644 index 44b48ce7634b..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_query_keys_operations.py +++ /dev/null @@ -1,432 +0,0 @@ -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -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 SearchManagementClientConfiguration -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, - search_service_name: str, - name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "name": _SERIALIZER.url("name", name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_search_service_request( - resource_group_name: str, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - search_service_name: str, - key: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "key": _SERIALIZER.url("key", key, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class QueryKeysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`query_keys` 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: SearchManagementClientConfiguration = 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 create( - self, - resource_group_name: str, - search_service_name: str, - name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.QueryKey: - """Generates a new query key for the specified search service. You can create up to 50 query keys - per service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param name: The name of the new query API key. Required. - :type name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: QueryKey or the result of cls(response) - :rtype: ~azure.mgmt.search.models.QueryKey - :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.QueryKey] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_create_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - name=name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("QueryKey", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_search_service( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> Iterable["_models.QueryKey"]: - """Returns the list of query API keys for the given Azure AI Search service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either QueryKey or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.QueryKey] - :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.ListQueryKeysResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_search_service_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("ListQueryKeysResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - search_service_name: str, - key: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> None: - """Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process - for regenerating a query key is to delete and then recreate it. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param key: The query key to be deleted. Query keys are identified by value, not by name. - Required. - :type key: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_delete_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - key=key, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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, 404]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_search_management_client_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_search_management_client_operations.py deleted file mode 100644 index 95dceb8e547e..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_search_management_client_operations.py +++ /dev/null @@ -1,142 +0,0 @@ -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 SearchManagementClientConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_usage_by_subscription_sku_request( - location: str, sku_name: str, subscription_id: str, *, client_request_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SearchManagementClientOperationsMixin(ClientMixinABC[PipelineClient, SearchManagementClientConfiguration]): - - @distributed_trace - def usage_by_subscription_sku( - self, - location: str, - sku_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.QuotaUsageResult: - """Gets the quota usage for a search SKU in the given subscription. - - .. seealso:: - - https://aka.ms/search-manage - - :param location: The unique location name for a Microsoft Azure geographic region. Required. - :type location: str - :param sku_name: The unique SKU name that identifies a billable tier. Required. - :type sku_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: QuotaUsageResult or the result of cls(response) - :rtype: ~azure.mgmt.search.models.QuotaUsageResult - :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.QuotaUsageResult] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_usage_by_subscription_sku_request( - location=location, - sku_name=sku_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("QuotaUsageResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py deleted file mode 100644 index 2495ac684aeb..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_services_operations.py +++ /dev/null @@ -1,1254 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# 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, Literal, 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 SearchManagementClientConfiguration -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_or_update_request( - resource_group_name: str, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-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.Search/searchServices/{searchServiceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - 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, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-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.Search/searchServices/{searchServiceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - 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_get_request( - resource_group_name: str, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, client_request_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request( - subscription_id: str, *, client_request_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_check_name_availability_request( - subscription_id: str, *, client_request_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-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.Search/checkNameAvailability" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_upgrade_request( - resource_group_name: str, search_service_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-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/upgrade", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`services` 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: SearchManagementClientConfiguration = 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_or_update_initial( - self, - resource_group_name: str, - search_service_name: str, - service: Union[_models.SearchService, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(service, (IOBase, bytes)): - _content = service - else: - _json = self._serialize.body(service, "SearchService") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, 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_or_update( - self, - resource_group_name: str, - search_service_name: str, - service: _models.SearchService, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SearchService]: - """Creates or updates a search service in the given resource group. If the search service already - exists, all properties will be updated with the given values. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to create or update. Search - service names must only contain lowercase letters, digits or dashes, cannot use dash as the - first two or last one characters, cannot contain consecutive dashes, and must be between 2 and - 60 characters in length. Search service names must be unique since they are part of the service - URI (https://\\ :code:``.search.windows.net). You cannot change the service name after - the service is created. Required. - :type search_service_name: str - :param service: The definition of the search service to create or update. Required. - :type service: ~azure.mgmt.search.models.SearchService - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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 SearchService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - search_service_name: str, - service: IO[bytes], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SearchService]: - """Creates or updates a search service in the given resource group. If the search service already - exists, all properties will be updated with the given values. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to create or update. Search - service names must only contain lowercase letters, digits or dashes, cannot use dash as the - first two or last one characters, cannot contain consecutive dashes, and must be between 2 and - 60 characters in length. Search service names must be unique since they are part of the service - URI (https://\\ :code:``.search.windows.net). You cannot change the service name after - the service is created. Required. - :type search_service_name: str - :param service: The definition of the search service to create or update. Required. - :type service: IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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 SearchService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - search_service_name: str, - service: Union[_models.SearchService, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> LROPoller[_models.SearchService]: - """Creates or updates a search service in the given resource group. If the search service already - exists, all properties will be updated with the given values. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to create or update. Search - service names must only contain lowercase letters, digits or dashes, cannot use dash as the - first two or last one characters, cannot contain consecutive dashes, and must be between 2 and - 60 characters in length. Search service names must be unique since they are part of the service - URI (https://\\ :code:``.search.windows.net). You cannot change the service name after - the service is created. Required. - :type search_service_name: str - :param service: The definition of the search service to create or update. Is either a - SearchService type or a IO[bytes] type. Required. - :type service: ~azure.mgmt.search.models.SearchService or IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An instance of LROPoller that returns either SearchService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] - :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.SearchService] = 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, - search_service_name=search_service_name, - service=service, - search_management_request_options=search_management_request_options, - 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("SearchService", 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.SearchService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.SearchService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - search_service_name: str, - service: _models.SearchServiceUpdate, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SearchService: - """Updates an existing search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to update. Required. - :type search_service_name: str - :param service: The definition of the search service to update. Required. - :type service: ~azure.mgmt.search.models.SearchServiceUpdate - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SearchService or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SearchService - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - search_service_name: str, - service: IO[bytes], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SearchService: - """Updates an existing search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to update. Required. - :type search_service_name: str - :param service: The definition of the search service to update. Required. - :type service: IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SearchService or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SearchService - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - search_service_name: str, - service: Union[_models.SearchServiceUpdate, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.SearchService: - """Updates an existing search service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service to update. Required. - :type search_service_name: str - :param service: The definition of the search service to update. Is either a SearchServiceUpdate - type or a IO[bytes] type. Required. - :type service: ~azure.mgmt.search.models.SearchServiceUpdate or IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: SearchService or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SearchService - :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.SearchService] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(service, (IOBase, bytes)): - _content = service - else: - _json = self._serialize.body(service, "SearchServiceUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SearchService", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.SearchService: - """Gets the search service with the given name in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: SearchService or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SearchService - :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.SearchService] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SearchService", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> None: - """Deletes a search service in the given resource group, along with its associated resources. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_delete_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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, 404]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def list_by_resource_group( - self, - resource_group_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> Iterable["_models.SearchService"]: - """Gets a list of all Search services in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either SearchService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SearchService] - :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.SearchServiceListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("SearchServiceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_subscription( - self, search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> Iterable["_models.SearchService"]: - """Gets a list of all Search services in the given subscription. - - .. seealso:: - - https://aka.ms/search-manage - - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either SearchService or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SearchService] - :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.SearchServiceListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("SearchServiceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def check_name_availability( - self, - name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.CheckNameAvailabilityOutput: - """Checks whether or not the given search service name is available for use. Search service names - must be globally unique since they are part of the service URI (https://\\ - :code:``.search.windows.net). - - .. seealso:: - - https://aka.ms/search-manage - - :param name: The search service name to validate. Search service names must only contain - lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, - cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. - :type name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput - :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: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) - type: Literal["searchServices"] = kwargs.pop("type", "searchServices") - cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - _check_name_availability_input = _models.CheckNameAvailabilityInput(name=name, type=type) - _json = self._serialize.body(_check_name_availability_input, "CheckNameAvailabilityInput") - - _request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - client_request_id=_client_request_id, - api_version=api_version, - content_type=content_type, - json=_json, - 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _upgrade_initial(self, resource_group_name: str, search_service_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_upgrade_request( - resource_group_name=resource_group_name, - search_service_name=search_service_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 [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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - 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_upgrade( - self, resource_group_name: str, search_service_name: str, **kwargs: Any - ) -> LROPoller[_models.SearchService]: - """Upgrades the Azure AI Search service to the latest version available. - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :return: An instance of LROPoller that returns either SearchService or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SearchService] - :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.SearchService] = 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._upgrade_initial( - resource_group_name=resource_group_name, - search_service_name=search_service_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): - deserialized = self._deserialize("SearchService", 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": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.SearchService].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.SearchService]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py deleted file mode 100644 index 4d3140688bd7..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py +++ /dev/null @@ -1,795 +0,0 @@ -# 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 SearchManagementClientConfiguration -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_or_update_request( - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-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.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "sharedPrivateLinkResourceName": _SERIALIZER.url( - "shared_private_link_resource_name", shared_private_link_resource_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - 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_get_request( - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "sharedPrivateLinkResourceName": _SERIALIZER.url( - "shared_private_link_resource_name", shared_private_link_resource_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - "sharedPrivateLinkResourceName": _SERIALIZER.url( - "shared_private_link_resource_name", shared_private_link_resource_name, "str" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_service_request( - resource_group_name: str, - search_service_name: str, - subscription_id: str, - *, - client_request_id: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "searchServiceName": _SERIALIZER.url( - "search_service_name", search_service_name, "str", pattern=r"^(?=.{2,60}$)[a-z0-9][a-z0-9]+(-[a-z0-9]+)*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SharedPrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`shared_private_link_resources` 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: SearchManagementClientConfiguration = 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_or_update_initial( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(shared_private_link_resource, (IOBase, bytes)): - _content = shared_private_link_resource - else: - _json = self._serialize.body(shared_private_link_resource, "SharedPrivateLinkResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, 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_or_update( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - shared_private_link_resource: _models.SharedPrivateLinkResource, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SharedPrivateLinkResource]: - """Initiates the creation or update of a shared private link resource managed by the search - service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param shared_private_link_resource: The definition of the shared private link resource to - create or update. Required. - :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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 SharedPrivateLinkResource or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - shared_private_link_resource: IO[bytes], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SharedPrivateLinkResource]: - """Initiates the creation or update of a shared private link resource managed by the search - service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param shared_private_link_resource: The definition of the shared private link resource to - create or update. Required. - :type shared_private_link_resource: IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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 SharedPrivateLinkResource or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO[bytes]], - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> LROPoller[_models.SharedPrivateLinkResource]: - """Initiates the creation or update of a shared private link resource managed by the search - service in the given resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param shared_private_link_resource: The definition of the shared private link resource to - create or update. Is either a SharedPrivateLinkResource type or a IO[bytes] type. Required. - :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource or - IO[bytes] - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An instance of LROPoller that returns either SharedPrivateLinkResource or the result - of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] - :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.SharedPrivateLinkResource] = 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, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - shared_private_link_resource=shared_private_link_resource, - search_management_request_options=search_management_request_options, - 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("SharedPrivateLinkResource", 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": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.SharedPrivateLinkResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.SharedPrivateLinkResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> _models.SharedPrivateLinkResource: - """Gets the details of the shared private link resource managed by the search service in the given - resource group. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: SharedPrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource - :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.SharedPrivateLinkResource] = kwargs.pop("cls", None) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_get_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - search_service_name: str, - shared_private_link_resource_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **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) - - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_delete_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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, 404]: - 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) - raise HttpResponseError(response=response, 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, - search_service_name: str, - shared_private_link_resource_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Initiates the deletion of the shared private link resource from the search service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param shared_private_link_resource_name: The name of the shared private link resource managed - by the Azure AI Search service within the specified resource group. Required. - :type shared_private_link_resource_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :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, - search_service_name=search_service_name, - shared_private_link_resource_name=shared_private_link_resource_name, - search_management_request_options=search_management_request_options, - 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": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_service( - self, - resource_group_name: str, - search_service_name: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> Iterable["_models.SharedPrivateLinkResource"]: - """Gets a list of all shared private link resources managed by the given service. - - .. seealso:: - - https://aka.ms/search-manage - - :param resource_group_name: The name of the resource group within the current subscription. You - can obtain this value from the Azure Resource Manager API or the portal. Required. - :type resource_group_name: str - :param search_service_name: The name of the Azure AI Search service associated with the - specified resource group. Required. - :type search_service_name: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either SharedPrivateLinkResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResource] - :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.SharedPrivateLinkResourceListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_service_request( - resource_group_name=resource_group_name, - search_service_name=search_service_name, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("SharedPrivateLinkResourceListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_usages_operations.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_usages_operations.py deleted file mode 100644 index f0b8edc1f63d..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_usages_operations.py +++ /dev/null @@ -1,179 +0,0 @@ -# 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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar -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 SearchManagementClientConfiguration -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_list_by_subscription_request( - location: str, subscription_id: str, *, client_request_id: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages" - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if client_request_id is not None: - _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class UsagesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.search.SearchManagementClient`'s - :attr:`usages` 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: SearchManagementClientConfiguration = 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_by_subscription( - self, - location: str, - search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, - **kwargs: Any - ) -> Iterable["_models.QuotaUsageResult"]: - """Get a list of all Azure AI Search quota usages across the subscription. - - .. seealso:: - - https://aka.ms/search-manage - - :param location: The unique location name for a Microsoft Azure geographic region. Required. - :type location: str - :param search_management_request_options: Parameter group. Default value is None. - :type search_management_request_options: - ~azure.mgmt.search.models.SearchManagementRequestOptions - :return: An iterator like instance of either QuotaUsageResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.QuotaUsageResult] - :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.QuotaUsagesListResult] = 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: - _client_request_id = None - if search_management_request_options is not None: - _client_request_id = search_management_request_options.client_request_id - - _request = build_list_by_subscription_request( - location=location, - subscription_id=self._config.subscription_id, - client_request_id=_client_request_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("QuotaUsagesListResult", 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) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/search/azure-mgmt-search/generated_samples/create_or_update_shared_private_link_resource.py b/sdk/search/azure-mgmt-search/generated_samples/create_or_update_shared_private_link_resource.py index 9dbb76eb08eb..9d677d1cd10f 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/create_or_update_shared_private_link_resource.py +++ b/sdk/search/azure-mgmt-search/generated_samples/create_or_update_shared_private_link_resource.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.shared_private_link_resources.begin_create_or_update( @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/CreateOrUpdateSharedPrivateLinkResource.json +# x-ms-original-file: 2026-03-01-preview/CreateOrUpdateSharedPrivateLinkResource.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py b/sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py index b440ebb62511..63539180369d 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py +++ b/sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.delete( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: 2026-03-01-preview/DeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/delete_shared_private_link_resource.py b/sdk/search/azure-mgmt-search/generated_samples/delete_shared_private_link_resource.py index 986e99f171a3..25fd2bd9057a 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/delete_shared_private_link_resource.py +++ b/sdk/search/azure-mgmt-search/generated_samples/delete_shared_private_link_resource.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.shared_private_link_resources.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/DeleteSharedPrivateLinkResource.json +# x-ms-original-file: 2026-03-01-preview/DeleteSharedPrivateLinkResource.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py b/sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py index 2a9f9121d3f5..3845fd1c19c1 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py +++ b/sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: 2026-03-01-preview/GetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/get_quota_usage.py b/sdk/search/azure-mgmt-search/generated_samples/get_quota_usage.py index 10fca222c5f5..f17cc86f9af7 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/get_quota_usage.py +++ b/sdk/search/azure-mgmt-search/generated_samples/get_quota_usage.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.usage_by_subscription_sku( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/GetQuotaUsage.json +# x-ms-original-file: 2026-03-01-preview/GetQuotaUsage.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/get_quota_usages_list.py b/sdk/search/azure-mgmt-search/generated_samples/get_quota_usages_list.py index 23c014367453..6c6ab8a573d1 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/get_quota_usages_list.py +++ b/sdk/search/azure-mgmt-search/generated_samples/get_quota_usages_list.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.usages.list_by_subscription( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/GetQuotaUsagesList.json +# x-ms-original-file: 2026-03-01-preview/GetQuotaUsagesList.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/get_shared_private_link_resource.py b/sdk/search/azure-mgmt-search/generated_samples/get_shared_private_link_resource.py index 3e120aed0543..ae342c7a975f 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/get_shared_private_link_resource.py +++ b/sdk/search/azure-mgmt-search/generated_samples/get_shared_private_link_resource.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.shared_private_link_resources.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/GetSharedPrivateLinkResource.json +# x-ms-original-file: 2026-03-01-preview/GetSharedPrivateLinkResource.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/list_private_endpoint_connections_by_service.py b/sdk/search/azure-mgmt-search/generated_samples/list_private_endpoint_connections_by_service.py index b42ce070b5cc..4720ac6207bd 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/list_private_endpoint_connections_by_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/list_private_endpoint_connections_by_service.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.list_by_service( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/ListPrivateEndpointConnectionsByService.json +# x-ms-original-file: 2026-03-01-preview/ListPrivateEndpointConnectionsByService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/list_shared_private_link_resources_by_service.py b/sdk/search/azure-mgmt-search/generated_samples/list_shared_private_link_resources_by_service.py index 3eaadde56e07..361cd9d9cd49 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/list_shared_private_link_resources_by_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/list_shared_private_link_resources_by_service.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.shared_private_link_resources.list_by_service( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/ListSharedPrivateLinkResourcesByService.json +# x-ms-original-file: 2026-03-01-preview/ListSharedPrivateLinkResourcesByService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/list_supported_private_link_resources.py b/sdk/search/azure-mgmt-search/generated_samples/list_supported_private_link_resources.py index 2dba89ec2b95..619497a868f1 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/list_supported_private_link_resources.py +++ b/sdk/search/azure-mgmt-search/generated_samples/list_supported_private_link_resources.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_resources.list_supported( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/ListSupportedPrivateLinkResources.json +# x-ms-original-file: 2026-03-01-preview/ListSupportedPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_get.py b/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_get.py index d2ec65a5d388..a1c38b122970 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_get.py +++ b/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_get.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.network_security_perimeter_configurations.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/NetworkSecurityPerimeterConfigurationsGet.json +# x-ms-original-file: 2026-03-01-preview/NetworkSecurityPerimeterConfigurationsGet.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_list_by_service.py b/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_list_by_service.py index 4deb6e2a4f18..6a4a0c617eac 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_list_by_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_list_by_service.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.network_security_perimeter_configurations.list_by_service( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/NetworkSecurityPerimeterConfigurationsListByService.json +# x-ms-original-file: 2026-03-01-preview/NetworkSecurityPerimeterConfigurationsListByService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_reconcile.py b/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_reconcile.py index 4908e6d6a617..a139a65a3bc7 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_reconcile.py +++ b/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_reconcile.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.network_security_perimeter_configurations.begin_reconcile( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/NetworkSecurityPerimeterConfigurationsReconcile.json +# x-ms-original-file: 2026-03-01-preview/NetworkSecurityPerimeterConfigurationsReconcile.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_check_name_availability.py b/sdk/search/azure-mgmt-search/generated_samples/search_check_name_availability.py new file mode 100644 index 000000000000..89be461a93e6 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_check_name_availability.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_check_name_availability.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 = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.services.check_name_availability( + check_name_availability_input={"name": "mysearchservice", "type": "searchServices"}, + ) + print(response) + + +# x-ms-original-file: 2026-03-01-preview/SearchCheckNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service.py index a4e106c43b28..c1922eb06a78 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -36,7 +35,7 @@ def main(): search_service_name="mysearchservice", service={ "location": "westus", - "properties": {"computeType": "default", "hostingMode": "default", "partitionCount": 1, "replicaCount": 3}, + "properties": {"computeType": "Default", "hostingMode": "Default", "partitionCount": 1, "replicaCount": 3}, "sku": {"name": "standard"}, "tags": {"app-name": "My e-commerce app"}, }, @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateService.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_auth_options.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_auth_options.py index 4bb60cc4d5bc..59d52b761b64 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_auth_options.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_auth_options.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -38,8 +37,8 @@ def main(): "location": "westus", "properties": { "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "http401WithBearerChallenge"}}, - "computeType": "default", - "hostingMode": "default", + "computeType": "Default", + "hostingMode": "Default", "partitionCount": 1, "replicaCount": 3, }, @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceAuthOptions.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceAuthOptions.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_disable_local_auth.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_disable_local_auth.py index d6fbd65eafc8..21cc5875188f 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_disable_local_auth.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_disable_local_auth.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -37,9 +36,9 @@ def main(): service={ "location": "westus", "properties": { - "computeType": "default", + "computeType": "Default", "disableLocalAuth": True, - "hostingMode": "default", + "hostingMode": "Default", "partitionCount": 1, "replicaCount": 3, }, @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceDisableLocalAuth.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_private_endpoints.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_private_endpoints.py index ce771e91015f..2cce969d947e 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_private_endpoints.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_private_endpoints.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -37,10 +36,10 @@ def main(): service={ "location": "westus", "properties": { - "computeType": "default", - "hostingMode": "default", + "computeType": "Default", + "hostingMode": "Default", "partitionCount": 1, - "publicNetworkAccess": "disabled", + "publicNetworkAccess": "Disabled", "replicaCount": 3, }, "sku": {"name": "standard"}, @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips.py index e3b15c60f4c3..7d964336ebe2 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -37,8 +36,8 @@ def main(): service={ "location": "westus", "properties": { - "computeType": "default", - "hostingMode": "default", + "computeType": "Default", + "hostingMode": "Default", "networkRuleSet": {"ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}]}, "partitionCount": 1, "replicaCount": 1, @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips_and_bypass.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips_and_bypass.py index 5b5e17f6e90c..26361d119c8e 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips_and_bypass.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips_and_bypass.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -37,10 +36,10 @@ def main(): service={ "location": "westus", "properties": { - "computeType": "default", - "hostingMode": "default", + "computeType": "Default", + "hostingMode": "Default", "networkRuleSet": { - "bypass": "AzureServices", + "bypass": "AzurePortal", "ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}], }, "partitionCount": 1, @@ -53,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_cmk_enforcement.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_cmk_enforcement.py index c6799a3592f7..cb3065055158 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_cmk_enforcement.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_cmk_enforcement.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -37,9 +36,9 @@ def main(): service={ "location": "westus", "properties": { - "computeType": "default", + "computeType": "Default", "encryptionWithCmk": {"enforcement": "Enabled"}, - "hostingMode": "default", + "hostingMode": "Default", "partitionCount": 1, "replicaCount": 3, }, @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceWithCmkEnforcement.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_data_exfiltration.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_data_exfiltration.py index 6ee4ef665ae2..3bfc7d2297da 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_data_exfiltration.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_data_exfiltration.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -37,9 +36,9 @@ def main(): service={ "location": "westus", "properties": { - "computeType": "default", + "computeType": "Default", "dataExfiltrationProtections": ["BlockAll"], - "hostingMode": "default", + "hostingMode": "Default", "partitionCount": 1, "replicaCount": 3, }, @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceWithDataExfiltration.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceWithDataExfiltration.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_identity.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_identity.py index c9c1064db6db..3329114ec0c7 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_identity.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_identity.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -42,7 +42,7 @@ def main(): }, }, "location": "westus", - "properties": {"computeType": "default", "hostingMode": "default", "partitionCount": 1, "replicaCount": 3}, + "properties": {"computeType": "Default", "hostingMode": "Default", "partitionCount": 1, "replicaCount": 3}, "sku": {"name": "standard"}, "tags": {"app-name": "My e-commerce app"}, }, @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceWithIdentity.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceWithIdentity.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_serverless.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_serverless.py new file mode 100644 index 000000000000..5aad428ee840 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_serverless.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_create_or_update_service_with_serverless.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 = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.services.begin_create_or_update( + resource_group_name="rg1", + search_service_name="myserverlessservice", + service={ + "location": "westus", + "properties": {"hostingMode": "Default"}, + "sku": {"name": "serverless"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceWithServerless.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_service_level_cmk_multi_tenant_federated_identity.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_service_level_cmk_multi_tenant_federated_identity.py new file mode 100644 index 000000000000..6ea0ef0a34ce --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_service_level_cmk_multi_tenant_federated_identity.py @@ -0,0 +1,74 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_create_or_update_service_with_service_level_cmk_multi_tenant_federated_identity.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 = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.services.begin_create_or_update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "identity": { + "type": "SystemAssigned, UserAssigned", + "userAssignedIdentities": { + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi": {} + }, + }, + "location": "westus", + "properties": { + "computeType": "Default", + "encryptionWithCmk": { + "encryptionComplianceStatus": "Compliant", + "enforcement": "Enabled", + "serviceLevelEncryptionKey": { + "identity": { + "@odata.type": "#Microsoft.Azure.Search.DataUserAssignedIdentity", + "federatedIdentityClientId": "f83c6b1b-4d34-47e4-bb34-9d83df58b540", + "userAssignedIdentity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/user-mi", + }, + "keyVaultKeyName": "myUserManagedEncryptionKey-createdinAzureKeyVault", + "keyVaultKeyVersion": "myKeyVersion-32charAlphaNumericString", + "keyVaultUri": "https://myKeyVault.vault.azure.net", + }, + }, + "hostingMode": "Default", + "partitionCount": 1, + "replicaCount": 3, + }, + "sku": {"name": "standard"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateServiceWithServiceLevelCmkMultiTenantFederatedIdentity.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_knowledge_retrieval.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_knowledge_retrieval.py new file mode 100644 index 000000000000..5cdb1e662b70 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_knowledge_retrieval.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_create_or_update_with_knowledge_retrieval.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 = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.services.begin_create_or_update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "location": "westus", + "properties": { + "computeType": "Default", + "hostingMode": "Default", + "knowledgeRetrieval": "free", + "partitionCount": 1, + "replicaCount": 3, + }, + "sku": {"name": "standard"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateWithKnowledgeRetrieval.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_semantic_search.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_semantic_search.py index b299d8378019..1259fef7731c 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_semantic_search.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_semantic_search.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -37,8 +36,8 @@ def main(): service={ "location": "westus", "properties": { - "computeType": "default", - "hostingMode": "default", + "computeType": "Default", + "hostingMode": "Default", "partitionCount": 1, "replicaCount": 3, "semanticSearch": "free", @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateWithSemanticSearch.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateOrUpdateWithSemanticSearch.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_create_query_key.py b/sdk/search/azure-mgmt-search/generated_samples/search_create_query_key.py index 31aad29d4f24..2842c91d0b70 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_query_key.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_query_key.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.query_keys.create( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateQueryKey.json +# x-ms-original-file: 2026-03-01-preview/SearchCreateQueryKey.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py b/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py index 0774d4fa17b3..c113b1769b3f 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.query_keys.delete( @@ -38,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchDeleteQueryKey.json +# x-ms-original-file: 2026-03-01-preview/SearchDeleteQueryKey.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py index 26484e702c01..e34425d30e8a 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) client.services.delete( @@ -37,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchDeleteService.json +# x-ms-original-file: 2026-03-01-preview/SearchDeleteService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_get_admin_keys.py b/sdk/search/azure-mgmt-search/generated_samples/search_get_admin_keys.py index c2b289105636..171ff3ec78aa 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_get_admin_keys.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_get_admin_keys.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.admin_keys.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchGetAdminKeys.json +# x-ms-original-file: 2026-03-01-preview/SearchGetAdminKeys.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_get_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_get_service.py index a9714a4a6609..d93304e6acaa 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_get_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_get_service.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchGetService.json +# x-ms-original-file: 2026-03-01-preview/SearchGetService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_list_offerings.py b/sdk/search/azure-mgmt-search/generated_samples/search_list_offerings.py new file mode 100644 index 000000000000..abcba6047c2b --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_list_offerings.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_list_offerings.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 = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.offerings.list() + print(response) + + +# x-ms-original-file: 2026-03-01-preview/SearchListOfferings.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_list_operations.py b/sdk/search/azure-mgmt-search/generated_samples/search_list_operations.py index 8083bbdc3c70..7eaa4b396930 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_list_operations.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_list_operations.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchListOperations.json +# x-ms-original-file: 2026-03-01-preview/SearchListOperations.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_list_query_keys_by_search_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_list_query_keys_by_search_service.py index a5f2f00ce61a..41fcfac6ee1c 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_list_query_keys_by_search_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_list_query_keys_by_search_service.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.query_keys.list_by_search_service( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchListQueryKeysBySearchService.json +# x-ms-original-file: 2026-03-01-preview/SearchListQueryKeysBySearchService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_resource_group.py b/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_resource_group.py index be6a5037e875..75ef99d0b0d1 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_resource_group.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_resource_group.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchListServicesByResourceGroup.json +# x-ms-original-file: 2026-03-01-preview/SearchListServicesByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_subscription.py b/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_subscription.py index d27e8765b6af..4561cd9f48e2 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_subscription.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_list_services_by_subscription.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchListServicesBySubscription.json +# x-ms-original-file: 2026-03-01-preview/SearchListServicesBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_regenerate_admin_key.py b/sdk/search/azure-mgmt-search/generated_samples/search_regenerate_admin_key.py index fa29d6793400..1acddfaba179 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_regenerate_admin_key.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_regenerate_admin_key.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.admin_keys.regenerate( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchRegenerateAdminKey.json +# x-ms-original-file: 2026-03-01-preview/SearchRegenerateAdminKey.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service.py index 62b97e69b0a9..eaaa77d247e5 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateService.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateService.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_auth_options.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_auth_options.py index e2d825ec1738..2e0303503a34 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_auth_options.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_auth_options.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -45,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceAuthOptions.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceAuthOptions.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_disable_local_auth.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_disable_local_auth.py index df865f7b2455..c3d6be607763 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_disable_local_auth.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_disable_local_auth.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceDisableLocalAuth.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceDisableLocalAuth.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_private_endpoints.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_private_endpoints.py index 49de723443f9..1e41fcde57cd 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_private_endpoints.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_private_endpoints.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,17 +27,17 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( resource_group_name="rg1", search_service_name="mysearchservice", - service={"properties": {"partitionCount": 1, "publicNetworkAccess": "disabled", "replicaCount": 1}}, + service={"properties": {"partitionCount": 1, "publicNetworkAccess": "Disabled", "replicaCount": 1}}, ) print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips.py index 4841626974d8..c0ac512bf432 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -36,9 +35,9 @@ def main(): search_service_name="mysearchservice", service={ "properties": { - "networkRuleSet": {"ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}]}, + "networkRuleSet": {"bypass": "None", "ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}]}, "partitionCount": 1, - "publicNetworkAccess": "enabled", + "publicNetworkAccess": "Enabled", "replicaCount": 3, } }, @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips_and_bypass.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips_and_bypass.py index dbcfd7e0b0b6..0a1ee9496f35 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips_and_bypass.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips_and_bypass.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -37,11 +36,11 @@ def main(): service={ "properties": { "networkRuleSet": { - "bypass": "AzureServices", + "bypass": "AzurePortal", "ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}], }, "partitionCount": 1, - "publicNetworkAccess": "enabled", + "publicNetworkAccess": "Enabled", "replicaCount": 3, } }, @@ -49,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceToAllowAccessFromPublicCustomIPsAndBypass.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_remove_identity.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_remove_identity.py index aa8e6de2047a..605eddf82c72 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_remove_identity.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_remove_identity.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceToRemoveIdentity.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceToRemoveIdentity.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_cmk_enforcement.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_cmk_enforcement.py index 81fe58eb08ab..96ce46a07056 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_cmk_enforcement.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_cmk_enforcement.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceWithCmkEnforcement.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceWithCmkEnforcement.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_data_exfiltration.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_data_exfiltration.py index 529b2f9f1ce5..d9db637af1ad 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_data_exfiltration.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_data_exfiltration.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceWithDataExfiltration.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceWithDataExfiltration.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_knowledge_retrieval.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_knowledge_retrieval.py new file mode 100644 index 000000000000..4695bcb54c38 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_knowledge_retrieval.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.search import SearchManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-search +# USAGE + python search_update_service_with_knowledge_retrieval.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 = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.services.update( + resource_group_name="rg1", + search_service_name="mysearchservice", + service={ + "properties": {"knowledgeRetrieval": "standard", "replicaCount": 2}, + "tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"}, + }, + ) + print(response) + + +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceWithKnowledgeRetrieval.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_semantic_search.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_semantic_search.py index dec0b5d81283..a859bdea5cb0 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_semantic_search.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_semantic_search.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceWithSemanticSearch.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceWithSemanticSearch.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_sku.py b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_sku.py index 51355afddbf3..57f3f8945ec4 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_sku.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_sku.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceWithSku.json +# x-ms-original-file: 2026-03-01-preview/SearchUpdateServiceWithSku.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py b/sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py index fa868c2b117c..bdb90ac0ca07 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py +++ b/sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.update( @@ -37,13 +37,16 @@ def main(): private_endpoint_connection_name="testEndpoint.50bf4fbe-d7c1-4b48-a642-4f5892642546", private_endpoint_connection={ "properties": { - "privateLinkServiceConnectionState": {"description": "Rejected for some reason.", "status": "Rejected"} + "privateLinkServiceConnectionState": { + "description": "Connection is rejected due to lack of authorization or failure to meet security compliance requirements.", + "status": "Rejected", + } } }, ) print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/UpdatePrivateEndpointConnection.json +# x-ms-original-file: 2026-03-01-preview/UpdatePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/upgrade_search_service_to_latest_version.py b/sdk/search/azure-mgmt-search/generated_samples/upgrade_search_service_to_latest_version.py index 4a274175bb54..39ec91859459 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/upgrade_search_service_to_latest_version.py +++ b/sdk/search/azure-mgmt-search/generated_samples/upgrade_search_service_to_latest_version.py @@ -1,9 +1,8 @@ -# 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = SearchManagementClient( credential=DefaultAzureCredential(), - subscription_id="subid", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_upgrade( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/UpgradeSearchServiceToLatestVersion.json +# x-ms-original-file: 2026-03-01-preview/UpgradeSearchServiceToLatestVersion.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_tests/conftest.py b/sdk/search/azure-mgmt-search/generated_tests/conftest.py index 16cc48c352e7..3cfc18a99408 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/conftest.py +++ b/sdk/search/azure-mgmt-search/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management.py index 4ed7ed23a7b9..56512d38a24d 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_usage_by_subscription_sku(self, resource_group): response = self.client.usage_by_subscription_sku( location="str", sku_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations.py index b24cc56a7942..d129ac9aa248 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_admin_keys_get(self, resource_group): response = self.client.admin_keys.get( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -37,7 +36,6 @@ def test_admin_keys_regenerate(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", key_kind="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations_async.py index 537e68ac8eb9..5de386fee1ee 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ async def test_admin_keys_get(self, resource_group): response = await self.client.admin_keys.get( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -38,7 +37,6 @@ async def test_admin_keys_regenerate(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", key_kind="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_async.py index 4eb76cd346b6..0eed13403753 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ async def test_usage_by_subscription_sku(self, resource_group): response = await self.client.usage_by_subscription_sku( location="str", sku_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_network_security_perimeter_configurations_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_network_security_perimeter_configurations_operations.py index 179d189e39c5..72226f1a49bd 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_network_security_perimeter_configurations_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_network_security_perimeter_configurations_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -20,26 +20,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_network_security_perimeter_configurations_list_by_service(self, resource_group): - response = self.client.network_security_perimeter_configurations.list_by_service( + def test_network_security_perimeter_configurations_get(self, resource_group): + response = self.client.network_security_perimeter_configurations.get( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", + nsp_config_name="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_network_security_perimeter_configurations_get(self, resource_group): - response = self.client.network_security_perimeter_configurations.get( + def test_network_security_perimeter_configurations_list_by_service(self, resource_group): + response = self.client.network_security_perimeter_configurations.list_by_service( resource_group_name=resource_group.name, search_service_name="str", - nsp_config_name="str", - api_version="2025-05-01", ) - + result = [r for r in response] # please add some check logic here by yourself # ... @@ -50,7 +48,6 @@ def test_network_security_perimeter_configurations_begin_reconcile(self, resourc resource_group_name=resource_group.name, search_service_name="str", nsp_config_name="str", - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_network_security_perimeter_configurations_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_network_security_perimeter_configurations_operations_async.py index 62476a20d40f..38d8b51269af 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_network_security_perimeter_configurations_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_network_security_perimeter_configurations_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,26 +21,24 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_network_security_perimeter_configurations_list_by_service(self, resource_group): - response = self.client.network_security_perimeter_configurations.list_by_service( + 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, search_service_name="str", - api_version="2025-05-01", + nsp_config_name="str", ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_network_security_perimeter_configurations_get(self, resource_group): - response = await self.client.network_security_perimeter_configurations.get( + async def test_network_security_perimeter_configurations_list_by_service(self, resource_group): + response = self.client.network_security_perimeter_configurations.list_by_service( resource_group_name=resource_group.name, search_service_name="str", - nsp_config_name="str", - api_version="2025-05-01", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -52,7 +50,6 @@ async def test_network_security_perimeter_configurations_begin_reconcile(self, r resource_group_name=resource_group.name, search_service_name="str", nsp_config_name="str", - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_offerings_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_offerings_operations.py index 954264d9a280..6c9f014f8dd1 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_offerings_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_offerings_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,9 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_offerings_list(self, resource_group): - response = self.client.offerings.list( - api_version="2025-02-01-preview", - ) - result = [r for r in response] + response = self.client.offerings.list() + # please add some check logic here by yourself # ... diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_offerings_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_offerings_operations_async.py index 736f3332d010..cc7cdd45be5e 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_offerings_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_offerings_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -22,9 +22,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_offerings_list(self, resource_group): - response = self.client.offerings.list( - api_version="2025-02-01-preview", - ) - result = [r async for r in response] + response = await self.client.offerings.list() + # please add some check logic here by yourself # ... diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations.py index 0917694f8a6a..20d0fd103e0d 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,9 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-05-01", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations_async.py index 1746785cafd8..4db749e31ac0 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -22,9 +22,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-05-01", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations.py index e644d8c37dcb..31655a4d2ddc 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,18 @@ class TestSearchManagementPrivateEndpointConnectionsOperations(AzureMgmtRecorded def setup_method(self, method): self.client = self.create_mgmt_client(SearchManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_get(self, resource_group): + response = self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + search_service_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_private_endpoint_connections_update(self, resource_group): @@ -32,7 +44,7 @@ def test_private_endpoint_connections_update(self, resource_group): "groupId": "str", "privateEndpoint": {"id": "str"}, "privateLinkServiceConnectionState": { - "actionsRequired": "None", + "actionsRequired": "str", "description": "str", "status": "str", }, @@ -48,20 +60,6 @@ def test_private_endpoint_connections_update(self, resource_group): }, "type": "str", }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_get(self, resource_group): - response = self.client.private_endpoint_connections.get( - resource_group_name=resource_group.name, - search_service_name="str", - private_endpoint_connection_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -74,7 +72,6 @@ def test_private_endpoint_connections_delete(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -86,7 +83,6 @@ def test_private_endpoint_connections_list_by_service(self, resource_group): response = self.client.private_endpoint_connections.list_by_service( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations_async.py index 40072d778937..059ecb2557e0 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,18 @@ class TestSearchManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRec def setup_method(self, method): self.client = self.create_mgmt_client(SearchManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_get(self, resource_group): + response = await self.client.private_endpoint_connections.get( + resource_group_name=resource_group.name, + search_service_name="str", + private_endpoint_connection_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_private_endpoint_connections_update(self, resource_group): @@ -33,7 +45,7 @@ async def test_private_endpoint_connections_update(self, resource_group): "groupId": "str", "privateEndpoint": {"id": "str"}, "privateLinkServiceConnectionState": { - "actionsRequired": "None", + "actionsRequired": "str", "description": "str", "status": "str", }, @@ -49,20 +61,6 @@ async def test_private_endpoint_connections_update(self, resource_group): }, "type": "str", }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_get(self, resource_group): - response = await self.client.private_endpoint_connections.get( - resource_group_name=resource_group.name, - search_service_name="str", - private_endpoint_connection_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -75,7 +73,6 @@ async def test_private_endpoint_connections_delete(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", private_endpoint_connection_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -87,7 +84,6 @@ async def test_private_endpoint_connections_list_by_service(self, resource_group response = self.client.private_endpoint_connections.list_by_service( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations.py index 8f0ba5742f82..aea21e40cfc3 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def test_private_link_resources_list_supported(self, resource_group): response = self.client.private_link_resources.list_supported( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations_async.py index 127bfee7fac2..027ca22f5515 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ async def test_private_link_resources_list_supported(self, resource_group): response = self.client.private_link_resources.list_supported( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations.py index fa89e0ce01ff..19cd58e5b09c 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -25,7 +25,6 @@ def test_query_keys_create(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -37,7 +36,6 @@ def test_query_keys_list_by_search_service(self, resource_group): response = self.client.query_keys.list_by_search_service( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -50,7 +48,6 @@ def test_query_keys_delete(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", key="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations_async.py index 8aab03e30b32..4cf3e37eaf72 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -26,7 +26,6 @@ async def test_query_keys_create(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -38,7 +37,6 @@ async def test_query_keys_list_by_search_service(self, resource_group): response = self.client.query_keys.list_by_search_service( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -51,7 +49,6 @@ async def test_query_keys_delete(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", key="str", - api_version="2025-05-01", ) # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_service_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_service_operations.py deleted file mode 100644 index dbceb47babce..000000000000 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_service_operations.py +++ /dev/null @@ -1,31 +0,0 @@ -# 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.search import SearchManagementClient - -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 TestSearchManagementServiceOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(SearchManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_service_begin_upgrade(self, resource_group): - response = self.client.service.begin_upgrade( - resource_group_name=resource_group.name, - search_service_name="str", - api_version="2025-02-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_service_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_service_operations_async.py deleted file mode 100644 index dd9978a96a25..000000000000 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_service_operations_async.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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.search.aio import SearchManagementClient - -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 TestSearchManagementServiceOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(SearchManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_service_begin_upgrade(self, resource_group): - response = await ( - await self.client.service.begin_upgrade( - resource_group_name=resource_group.name, - search_service_name="str", - api_version="2025-02-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations.py index 9cf81f1c87c3..a66a330fde7f 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,27 @@ class TestSearchManagementServicesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(SearchManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_services_check_name_availability(self, resource_group): + response = self.client.services.check_name_availability( + check_name_availability_input={"name": "str", "type": "searchServices"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_services_get(self, resource_group): + response = self.client.services.get( + resource_group_name=resource_group.name, + search_service_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_services_begin_create_or_update(self, resource_group): @@ -26,14 +47,6 @@ def test_services_begin_create_or_update(self, resource_group): search_service_name="str", service={ "location": "str", - "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, - "computeType": "str", - "dataExfiltrationProtections": ["str"], - "disableLocalAuth": bool, - "eTag": "str", - "encryptionWithCmk": {"encryptionComplianceStatus": "str", "enforcement": "str"}, - "endpoint": "str", - "hostingMode": "default", "id": "str", "identity": { "type": "str", @@ -42,64 +55,86 @@ def test_services_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "name": "str", - "networkRuleSet": {"bypass": "str", "ipRules": [{"value": "str"}]}, - "partitionCount": 1, - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "properties": { - "groupId": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "None", - "description": "str", + "properties": { + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, + "computeType": "str", + "dataExfiltrationProtections": ["str"], + "disableLocalAuth": bool, + "eTag": "str", + "encryptionWithCmk": { + "encryptionComplianceStatus": "str", + "enforcement": "str", + "serviceLevelEncryptionKey": { + "accessCredentials": {"applicationId": "str", "applicationSecret": "str"}, + "identity": "data_identity", + "keyVaultKeyName": "str", + "keyVaultKeyVersion": "str", + "keyVaultUri": "str", + }, + }, + "endpoint": "str", + "hostingMode": "str", + "knowledgeRetrieval": "str", + "networkRuleSet": {"bypass": "str", "ipRules": [{"value": "str"}]}, + "partitionCount": 0, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "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", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "replicaCount": 0, + "semanticSearch": "str", + "serviceUpgradedAt": "2020-02-20 00:00:00", + "sharedPrivateLinkResources": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", "status": "str", }, - "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", - }, - "type": "str", - } - ], - "provisioningState": "str", - "publicNetworkAccess": "enabled", - "replicaCount": 1, - "semanticSearch": "str", - "serviceUpgradedAt": "2020-02-20 00:00:00", - "sharedPrivateLinkResources": [ - { - "id": "str", - "name": "str", - "properties": { - "groupId": "str", - "privateLinkResourceId": "str", - "provisioningState": "str", - "requestMessage": "str", - "resourceRegion": "str", - "status": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - } - ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "status": "str", + "statusDetails": "str", + "upgradeAvailable": "str", + }, "sku": {"name": "str"}, - "status": "str", - "statusDetails": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -110,9 +145,7 @@ def test_services_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "upgradeAvailable": "str", }, - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -125,14 +158,6 @@ def test_services_update(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", service={ - "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, - "computeType": "str", - "dataExfiltrationProtections": ["str"], - "disableLocalAuth": bool, - "eTag": "str", - "encryptionWithCmk": {"encryptionComplianceStatus": "str", "enforcement": "str"}, - "endpoint": "str", - "hostingMode": "default", "id": "str", "identity": { "type": "str", @@ -142,64 +167,86 @@ def test_services_update(self, resource_group): }, "location": "str", "name": "str", - "networkRuleSet": {"bypass": "str", "ipRules": [{"value": "str"}]}, - "partitionCount": 1, - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "properties": { - "groupId": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "None", - "description": "str", + "properties": { + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, + "computeType": "str", + "dataExfiltrationProtections": ["str"], + "disableLocalAuth": bool, + "eTag": "str", + "encryptionWithCmk": { + "encryptionComplianceStatus": "str", + "enforcement": "str", + "serviceLevelEncryptionKey": { + "accessCredentials": {"applicationId": "str", "applicationSecret": "str"}, + "identity": "data_identity", + "keyVaultKeyName": "str", + "keyVaultKeyVersion": "str", + "keyVaultUri": "str", + }, + }, + "endpoint": "str", + "hostingMode": "str", + "knowledgeRetrieval": "str", + "networkRuleSet": {"bypass": "str", "ipRules": [{"value": "str"}]}, + "partitionCount": 0, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "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", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "replicaCount": 0, + "semanticSearch": "str", + "serviceUpgradedAt": "2020-02-20 00:00:00", + "sharedPrivateLinkResources": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", "status": "str", }, - "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", - }, - "type": "str", - } - ], - "provisioningState": "str", - "publicNetworkAccess": "enabled", - "replicaCount": 1, - "semanticSearch": "str", - "serviceUpgradedAt": "2020-02-20 00:00:00", - "sharedPrivateLinkResources": [ - { - "id": "str", - "name": "str", - "properties": { - "groupId": "str", - "privateLinkResourceId": "str", - "provisioningState": "str", - "requestMessage": "str", - "resourceRegion": "str", - "status": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - } - ], + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "status": "str", + "statusDetails": "str", + "upgradeAvailable": "str", + }, "sku": {"name": "str"}, - "status": "str", - "statusDetails": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -210,21 +257,7 @@ def test_services_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "upgradeAvailable": "str", }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_services_get(self, resource_group): - response = self.client.services.get( - resource_group_name=resource_group.name, - search_service_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -236,7 +269,6 @@ def test_services_delete(self, resource_group): response = self.client.services.delete( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -247,7 +279,6 @@ def test_services_delete(self, resource_group): def test_services_list_by_resource_group(self, resource_group): response = self.client.services.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -256,32 +287,17 @@ def test_services_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_services_list_by_subscription(self, resource_group): - response = self.client.services.list_by_subscription( - api_version="2025-05-01", - ) + response = self.client.services.list_by_subscription() result = [r for r in response] # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_services_check_name_availability(self, resource_group): - response = self.client.services.check_name_availability( - name="str", - api_version="2025-05-01", - type="searchServices", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_services_begin_upgrade(self, resource_group): response = self.client.services.begin_upgrade( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations_async.py index 928292918ca3..b3e165e9ad3f 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,27 @@ class TestSearchManagementServicesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(SearchManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_services_check_name_availability(self, resource_group): + response = await self.client.services.check_name_availability( + check_name_availability_input={"name": "str", "type": "searchServices"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_services_get(self, resource_group): + response = await self.client.services.get( + resource_group_name=resource_group.name, + search_service_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_services_begin_create_or_update(self, resource_group): @@ -28,14 +49,6 @@ async def test_services_begin_create_or_update(self, resource_group): search_service_name="str", service={ "location": "str", - "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, - "computeType": "str", - "dataExfiltrationProtections": ["str"], - "disableLocalAuth": bool, - "eTag": "str", - "encryptionWithCmk": {"encryptionComplianceStatus": "str", "enforcement": "str"}, - "endpoint": "str", - "hostingMode": "default", "id": "str", "identity": { "type": "str", @@ -44,8 +57,141 @@ async def test_services_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "name": "str", + "properties": { + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, + "computeType": "str", + "dataExfiltrationProtections": ["str"], + "disableLocalAuth": bool, + "eTag": "str", + "encryptionWithCmk": { + "encryptionComplianceStatus": "str", + "enforcement": "str", + "serviceLevelEncryptionKey": { + "accessCredentials": {"applicationId": "str", "applicationSecret": "str"}, + "identity": "data_identity", + "keyVaultKeyName": "str", + "keyVaultKeyVersion": "str", + "keyVaultUri": "str", + }, + }, + "endpoint": "str", + "hostingMode": "str", + "knowledgeRetrieval": "str", + "networkRuleSet": {"bypass": "str", "ipRules": [{"value": "str"}]}, + "partitionCount": 0, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "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", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "replicaCount": 0, + "semanticSearch": "str", + "serviceUpgradedAt": "2020-02-20 00:00:00", + "sharedPrivateLinkResources": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", + "status": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "status": "str", + "statusDetails": "str", + "upgradeAvailable": "str", + }, + "sku": {"name": "str"}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_services_update(self, resource_group): + response = await self.client.services.update( + resource_group_name=resource_group.name, + search_service_name="str", + service={ + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "location": "str", + "name": "str", + "properties": { + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, + "computeType": "str", + "dataExfiltrationProtections": ["str"], + "disableLocalAuth": bool, + "eTag": "str", + "encryptionWithCmk": { + "encryptionComplianceStatus": "str", + "enforcement": "str", + "serviceLevelEncryptionKey": { + "accessCredentials": {"applicationId": "str", "applicationSecret": "str"}, + "identity": "data_identity", + "keyVaultKeyName": "str", + "keyVaultKeyVersion": "str", + "keyVaultUri": "str", + }, + }, + "endpoint": "str", + "hostingMode": "str", + "knowledgeRetrieval": "str", "networkRuleSet": {"bypass": "str", "ipRules": [{"value": "str"}]}, - "partitionCount": 1, + "partitionCount": 0, "privateEndpointConnections": [ { "id": "str", @@ -54,7 +200,7 @@ async def test_services_begin_create_or_update(self, resource_group): "groupId": "str", "privateEndpoint": {"id": "str"}, "privateLinkServiceConnectionState": { - "actionsRequired": "None", + "actionsRequired": "str", "description": "str", "status": "str", }, @@ -72,8 +218,8 @@ async def test_services_begin_create_or_update(self, resource_group): } ], "provisioningState": "str", - "publicNetworkAccess": "enabled", - "replicaCount": 1, + "publicNetworkAccess": "str", + "replicaCount": 0, "semanticSearch": "str", "serviceUpgradedAt": "2020-02-20 00:00:00", "sharedPrivateLinkResources": [ @@ -99,110 +245,11 @@ async def test_services_begin_create_or_update(self, resource_group): "type": "str", } ], - "sku": {"name": "str"}, "status": "str", "statusDetails": "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", "upgradeAvailable": "str", }, - api_version="2025-05-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_services_update(self, resource_group): - response = await self.client.services.update( - resource_group_name=resource_group.name, - search_service_name="str", - service={ - "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, - "computeType": "str", - "dataExfiltrationProtections": ["str"], - "disableLocalAuth": bool, - "eTag": "str", - "encryptionWithCmk": {"encryptionComplianceStatus": "str", "enforcement": "str"}, - "endpoint": "str", - "hostingMode": "default", - "id": "str", - "identity": { - "type": "str", - "principalId": "str", - "tenantId": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "name": "str", - "networkRuleSet": {"bypass": "str", "ipRules": [{"value": "str"}]}, - "partitionCount": 1, - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "properties": { - "groupId": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "None", - "description": "str", - "status": "str", - }, - "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", - }, - "type": "str", - } - ], - "provisioningState": "str", - "publicNetworkAccess": "enabled", - "replicaCount": 1, - "semanticSearch": "str", - "serviceUpgradedAt": "2020-02-20 00:00:00", - "sharedPrivateLinkResources": [ - { - "id": "str", - "name": "str", - "properties": { - "groupId": "str", - "privateLinkResourceId": "str", - "provisioningState": "str", - "requestMessage": "str", - "resourceRegion": "str", - "status": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - } - ], "sku": {"name": "str"}, - "status": "str", - "statusDetails": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -213,21 +260,7 @@ async def test_services_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "upgradeAvailable": "str", }, - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_services_get(self, resource_group): - response = await self.client.services.get( - resource_group_name=resource_group.name, - search_service_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -239,7 +272,6 @@ async def test_services_delete(self, resource_group): response = await self.client.services.delete( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) # please add some check logic here by yourself @@ -250,7 +282,6 @@ async def test_services_delete(self, resource_group): async def test_services_list_by_resource_group(self, resource_group): response = self.client.services.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -259,25 +290,11 @@ async def test_services_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_services_list_by_subscription(self, resource_group): - response = self.client.services.list_by_subscription( - api_version="2025-05-01", - ) + response = self.client.services.list_by_subscription() result = [r async for r in response] # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_services_check_name_availability(self, resource_group): - response = await self.client.services.check_name_availability( - name="str", - api_version="2025-05-01", - type="searchServices", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_services_begin_upgrade(self, resource_group): @@ -285,7 +302,6 @@ async def test_services_begin_upgrade(self, resource_group): await self.client.services.begin_upgrade( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations.py index f38e1dae141a..29f4feb3de13 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -18,6 +18,18 @@ class TestSearchManagementSharedPrivateLinkResourcesOperations(AzureMgmtRecorded def setup_method(self, method): self.client = self.create_mgmt_client(SearchManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_shared_private_link_resources_get(self, resource_group): + response = self.client.shared_private_link_resources.get( + resource_group_name=resource_group.name, + search_service_name="str", + shared_private_link_resource_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_shared_private_link_resources_begin_create_or_update(self, resource_group): @@ -46,25 +58,11 @@ def test_shared_private_link_resources_begin_create_or_update(self, resource_gro }, "type": "str", }, - api_version="2025-05-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_shared_private_link_resources_get(self, resource_group): - response = self.client.shared_private_link_resources.get( - resource_group_name=resource_group.name, - search_service_name="str", - shared_private_link_resource_name="str", - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_shared_private_link_resources_begin_delete(self, resource_group): @@ -72,7 +70,6 @@ def test_shared_private_link_resources_begin_delete(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", shared_private_link_resource_name="str", - api_version="2025-05-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -84,7 +81,6 @@ def test_shared_private_link_resources_list_by_service(self, resource_group): response = self.client.shared_private_link_resources.list_by_service( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations_async.py index be86d33b544e..de10cd9b3862 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -19,6 +19,18 @@ class TestSearchManagementSharedPrivateLinkResourcesOperationsAsync(AzureMgmtRec def setup_method(self, method): self.client = self.create_mgmt_client(SearchManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_shared_private_link_resources_get(self, resource_group): + response = await self.client.shared_private_link_resources.get( + resource_group_name=resource_group.name, + search_service_name="str", + shared_private_link_resource_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_shared_private_link_resources_begin_create_or_update(self, resource_group): @@ -48,26 +60,12 @@ async def test_shared_private_link_resources_begin_create_or_update(self, resour }, "type": "str", }, - api_version="2025-05-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_shared_private_link_resources_get(self, resource_group): - response = await self.client.shared_private_link_resources.get( - resource_group_name=resource_group.name, - search_service_name="str", - shared_private_link_resource_name="str", - api_version="2025-05-01", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_shared_private_link_resources_begin_delete(self, resource_group): @@ -76,7 +74,6 @@ async def test_shared_private_link_resources_begin_delete(self, resource_group): resource_group_name=resource_group.name, search_service_name="str", shared_private_link_resource_name="str", - api_version="2025-05-01", ) ).result() # call '.result()' to poll until service return final result @@ -89,7 +86,6 @@ async def test_shared_private_link_resources_list_by_service(self, resource_grou response = self.client.shared_private_link_resources.list_by_service( resource_group_name=resource_group.name, search_service_name="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations.py index 98cc7343b1be..414c96c9831f 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -23,7 +23,6 @@ def setup_method(self, method): def test_usages_list_by_subscription(self, resource_group): response = self.client.usages.list_by_subscription( location="str", - api_version="2025-05-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations_async.py index c03f90fade77..7cf3fda3e3e9 100644 --- a/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations_async.py +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -24,7 +24,6 @@ def setup_method(self, method): async def test_usages_list_by_subscription(self, resource_group): response = self.client.usages.list_by_subscription( location="str", - api_version="2025-05-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/search/azure-mgmt-search/pyproject.toml b/sdk/search/azure-mgmt-search/pyproject.toml index 540da07d41af..f193258d6f3c 100644 --- a/sdk/search/azure-mgmt-search/pyproject.toml +++ b/sdk/search/azure-mgmt-search/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-search" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Search Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.9" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.search._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-search" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Search Management" +package_doc_id = "search" +is_stable = false +is_arm = true +sample_link = "" +title = "SearchManagementClient" +need_msrestazure = false +need_azuremgmtcore = true +exclude_folders = "" diff --git a/sdk/search/azure-mgmt-search/sdk_packaging.toml b/sdk/search/azure-mgmt-search/sdk_packaging.toml deleted file mode 100644 index 3f846434060f..000000000000 --- a/sdk/search/azure-mgmt-search/sdk_packaging.toml +++ /dev/null @@ -1,9 +0,0 @@ -[packaging] -package_name = "azure-mgmt-search" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Search Management" -package_doc_id = "search" -is_stable = true -is_arm = true -sample_link = "" -title = "SearchManagementClient" diff --git a/sdk/search/azure-mgmt-search/setup.py b/sdk/search/azure-mgmt-search/setup.py deleted file mode 100644 index 31b5a197654f..000000000000 --- a/sdk/search/azure-mgmt-search/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-search" -PACKAGE_PPRINT_NAME = "Search Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# 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"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.5.0", - ], - python_requires=">=3.9", -) diff --git a/sdk/search/azure-mgmt-search/tsp-location.yaml b/sdk/search/azure-mgmt-search/tsp-location.yaml new file mode 100644 index 000000000000..22f612221bde --- /dev/null +++ b/sdk/search/azure-mgmt-search/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/search/resource-manager/Microsoft.Search/Search +commit: f90ba8622a186403cc11d43b8977d6bfd8410742 +repo: Azure/azure-rest-api-specs +additionalDirectories: