From 13050078bcadab793c95be9836bd80d8c8073c67 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 6 Mar 2025 00:52:43 +0000 Subject: [PATCH] CodeGen from PR 33037 in Azure/azure-rest-api-specs Merge 333fb008ee222bdb661f0826df39a5573884122f into 6043a6aac4f0b1f9ead1360e33c0d5035636c35a --- sdk/search/azure-mgmt-search/_meta.json | 6 +- .../azure/mgmt/search/__init__.py | 12 +- .../azure/mgmt/search/_configuration.py | 12 +- .../mgmt/search/_search_management_client.py | 25 +- .../azure/mgmt/search/_serialization.py | 438 ++++--- .../azure/mgmt/search/_vendor.py | 11 - .../azure/mgmt/search/_version.py | 2 +- .../azure/mgmt/search/aio/__init__.py | 12 +- .../azure/mgmt/search/aio/_configuration.py | 12 +- .../search/aio/_search_management_client.py | 25 +- .../azure/mgmt/search/aio/_vendor.py | 3 - .../mgmt/search/aio/operations/__init__.py | 30 +- .../aio/operations/_admin_keys_operations.py | 30 +- ...ity_perimeter_configurations_operations.py | 324 ----- .../mgmt/search/aio/operations/_operations.py | 14 +- ...private_endpoint_connections_operations.py | 69 +- .../_private_link_resources_operations.py | 18 +- .../aio/operations/_query_keys_operations.py | 38 +- .../_search_management_client_operations.py | 16 +- .../aio/operations/_services_operations.py | 124 +- ...hared_private_link_resources_operations.py | 101 +- .../aio/operations/_usages_operations.py | 16 +- .../azure/mgmt/search/models/__init__.py | 167 +-- .../azure/mgmt/search/models/_models_py3.py | 1107 +++-------------- .../models/_search_management_client_enums.py | 113 +- .../azure/mgmt/search/operations/__init__.py | 30 +- .../operations/_admin_keys_operations.py | 41 +- ...ity_perimeter_configurations_operations.py | 436 ------- .../mgmt/search/operations/_operations.py | 15 +- ...private_endpoint_connections_operations.py | 92 +- .../_private_link_resources_operations.py | 23 +- .../operations/_query_keys_operations.py | 53 +- .../_search_management_client_operations.py | 19 +- .../search/operations/_services_operations.py | 132 +- ...hared_private_link_resources_operations.py | 124 +- .../search/operations/_usages_operations.py | 17 +- ..._or_update_shared_private_link_resource.py | 4 +- .../delete_private_endpoint_connection.py | 2 +- .../delete_shared_private_link_resource.py | 2 +- .../get_private_endpoint_connection.py | 2 +- .../generated_samples/get_quota_usage.py | 2 +- .../get_quota_usages_list.py | 2 +- .../get_shared_private_link_resource.py | 2 +- ...private_endpoint_connections_by_service.py | 2 +- ...hared_private_link_resources_by_service.py | 2 +- .../list_supported_private_link_resources.py | 2 +- ...k_security_perimeter_configurations_get.py | 43 - ...erimeter_configurations_list_by_service.py | 43 - ...rity_perimeter_configurations_reconcile.py | 42 - ..._list_operations.py => operations_list.py} | 4 +- .../search_create_or_update_service.py | 4 +- ...h_create_or_update_service_auth_options.py | 4 +- ...te_or_update_service_disable_local_auth.py | 4 +- ..._to_allow_access_from_private_endpoints.py | 4 +- ..._to_allow_access_from_public_custom_ips.py | 4 +- ...ccess_from_public_custom_ips_and_bypass.py | 58 - ..._or_update_service_with_cmk_enforcement.py | 4 +- ...r_update_service_with_data_exfiltration.py | 55 - ..._create_or_update_service_with_identity.py | 11 +- ...h_create_or_update_with_semantic_search.py | 4 +- .../search_create_query_key.py | 4 +- .../search_delete_query_key.py | 2 +- .../search_delete_service.py | 2 +- .../search_get_admin_keys.py | 2 +- .../generated_samples/search_get_service.py | 2 +- ...earch_list_query_keys_by_search_service.py | 2 +- .../search_list_services_by_resource_group.py | 2 +- .../search_list_services_by_subscription.py | 2 +- .../search_regenerate_admin_key.py | 7 +- .../search_update_service.py | 4 +- .../search_update_service_auth_options.py | 4 +- ...earch_update_service_disable_local_auth.py | 4 +- ..._to_allow_access_from_private_endpoints.py | 4 +- ..._to_allow_access_from_public_custom_ips.py | 4 +- ...ccess_from_public_custom_ips_and_bypass.py | 55 - ...earch_update_service_to_remove_identity.py | 4 +- ...rch_update_service_with_cmk_enforcement.py | 4 +- ...h_update_service_with_data_exfiltration.py | 48 - ...rch_update_service_with_semantic_search.py | 4 +- .../update_private_endpoint_connection.py | 6 +- .../generated_tests/conftest.py | 35 + .../generated_tests/test_search_management.py | 31 + ...search_management_admin_keys_operations.py | 44 + ..._management_admin_keys_operations_async.py | 45 + .../test_search_management_async.py | 32 + .../test_search_management_operations.py | 29 + ...test_search_management_operations_async.py | 30 + ...private_endpoint_connections_operations.py | 85 ++ ...e_endpoint_connections_operations_async.py | 86 ++ ...ement_private_link_resources_operations.py | 31 + ...private_link_resources_operations_async.py | 32 + ...search_management_query_keys_operations.py | 57 + ..._management_query_keys_operations_async.py | 58 + ...t_search_management_services_operations.py | 206 +++ ...ch_management_services_operations_async.py | 209 ++++ ...hared_private_link_resources_operations.py | 83 ++ ...private_link_resources_operations_async.py | 88 ++ ...est_search_management_usages_operations.py | 30 + ...arch_management_usages_operations_async.py | 31 + sdk/search/azure-mgmt-search/setup.py | 1 + 100 files changed, 2332 insertions(+), 3090 deletions(-) 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/operations/_network_security_perimeter_configurations_operations.py delete mode 100644 sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_get.py delete mode 100644 sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_list_by_service.py delete mode 100644 sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_reconcile.py rename sdk/search/azure-mgmt-search/generated_samples/{search_list_operations.py => operations_list.py} (92%) delete mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips_and_bypass.py delete mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_data_exfiltration.py delete mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips_and_bypass.py delete mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_data_exfiltration.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/conftest.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations_async.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_async.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations_async.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations_async.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations_async.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations_async.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations_async.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations_async.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations_async.py diff --git a/sdk/search/azure-mgmt-search/_meta.json b/sdk/search/azure-mgmt-search/_meta.json index ded015878367..6bebe18ca77d 100644 --- a/sdk/search/azure-mgmt-search/_meta.json +++ b/sdk/search/azure-mgmt-search/_meta.json @@ -1,11 +1,11 @@ { - "commit": "32f566eb38af9593cfc1ed183362471c50d67fb2", + "commit": "fbfd81439fe090a94ab61d5c0ec5714d59370cbe", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.16", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/search/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "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/s/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --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/azure/mgmt/search/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py index a55bcb4e1a94..bed79077840d 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._search_management_client import SearchManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._search_management_client import SearchManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "SearchManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py index ff7e48afe90c..fa550e384451 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class SearchManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class SearchManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for SearchManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,15 +26,16 @@ class SearchManagementClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. 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. + obtain this value from the Azure Resource Manager API, command line tools, or the portal. + Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-06-01-preview") + api_version: str = kwargs.pop("api_version", "2025-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py index a6728b4444f5..6932f344d357 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_search_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -19,7 +20,6 @@ from ._serialization import Deserializer, Serializer from .operations import ( AdminKeysOperations, - NetworkSecurityPerimeterConfigurationsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, @@ -31,14 +31,11 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class SearchManagementClient( - SearchManagementClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,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 + """Client that can be used to manage search services and API keys. :ivar operations: Operations operations :vartype operations: azure.mgmt.search.operations.Operations @@ -58,19 +55,16 @@ class SearchManagementClient( 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. :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. + obtain this value from the Azure Resource Manager API, command line tools, or the portal. + Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -124,9 +118,6 @@ def __init__( 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 - ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -153,7 +144,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "SearchManagementClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py index 2f781d740827..b24ab2885450 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +145,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -182,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -204,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -233,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -378,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -406,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -424,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -558,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -631,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -662,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,9 +776,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -726,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -819,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -977,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1352,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1361,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1401,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1414,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1503,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1625,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1645,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1718,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1730,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1741,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1766,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1832,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1847,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1875,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1885,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1908,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1922,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1937,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1974,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1994,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py index 7c69bc1c15b5..eb208b575e0a 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py @@ -8,25 +8,14 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import SearchManagementClientConfiguration if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core import PipelineClient from ._serialization import Deserializer, Serializer -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - class SearchManagementClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" 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 45e4d8f411b7..e5754a47ce68 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "9.2.0b2" +VERSION = "1.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 6baf3d114500..bf513e736924 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 @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._search_management_client import SearchManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._search_management_client import SearchManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "SearchManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py index fb0abe45928b..53125d104ceb 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 @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class SearchManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class SearchManagementClientConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for SearchManagementClient. Note that all parameters used to create this instance are saved as instance @@ -27,15 +26,16 @@ class SearchManagementClientConfiguration: # pylint: disable=too-many-instance- :param credential: Credential needed for the client to connect to Azure. 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. + obtain this value from the Azure Resource Manager API, command line tools, or the portal. + Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-06-01-preview") + api_version: str = kwargs.pop("api_version", "2025-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") 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/_search_management_client.py index 176552eaf99f..715615a0509d 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/_search_management_client.py @@ -8,6 +8,7 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -19,7 +20,6 @@ from ._configuration import SearchManagementClientConfiguration from .operations import ( AdminKeysOperations, - NetworkSecurityPerimeterConfigurationsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, @@ -31,14 +31,11 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class SearchManagementClient( - SearchManagementClientOperationsMixin -): # pylint: disable=client-accepts-api-version-keyword,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 + """Client that can be used to manage search services and API keys. :ivar operations: Operations operations :vartype operations: azure.mgmt.search.aio.operations.Operations @@ -59,19 +56,16 @@ class SearchManagementClient( 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. :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. + obtain this value from the Azure Resource Manager API, command line tools, or the portal. + Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-06-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-05-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -125,9 +119,6 @@ def __init__( 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 - ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any @@ -156,7 +147,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "SearchManagementClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_vendor.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_vendor.py index f66a40025d67..82391ad43bfe 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_vendor.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_vendor.py @@ -8,12 +8,9 @@ from abc import ABC from typing import TYPE_CHECKING -from azure.core.pipeline.transport import HttpRequest - from ._configuration import SearchManagementClientConfiguration if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core import AsyncPipelineClient from .._serialization import Deserializer, Serializer 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 57f8554fb6d4..cd9098b83bd2 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 @@ -5,20 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._admin_keys_operations import AdminKeysOperations -from ._query_keys_operations import QueryKeysOperations -from ._services_operations import ServicesOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations -from ._usages_operations import UsagesOperations -from ._search_management_client_operations import SearchManagementClientOperationsMixin -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +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 ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -31,7 +36,6 @@ "SharedPrivateLinkResourcesOperations", "UsagesOperations", "SearchManagementClientOperationsMixin", - "NetworkSecurityPerimeterConfigurationsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/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 index f7eb031b0a54..3a6919095558 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,21 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._admin_keys_operations import build_get_request, build_regenerate_request -from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,7 +60,7 @@ async def get( 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. + """Gets the primary and secondary admin API keys for the specified search service. .. seealso:: - https://aka.ms/search-manage @@ -72,8 +68,8 @@ async def get( :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. + :param search_service_name: The name of the 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: @@ -82,7 +78,7 @@ async def get( :rtype: ~azure.mgmt.search.models.AdminKeyResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +105,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -123,7 +118,7 @@ async def get( 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) + deserialized = self._deserialize("AdminKeyResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -148,8 +143,8 @@ async def regenerate( :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. + :param search_service_name: The name of the 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. @@ -161,7 +156,7 @@ async def regenerate( :rtype: ~azure.mgmt.search.models.AdminKeyResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -189,7 +184,6 @@ async def regenerate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -203,7 +197,7 @@ async def regenerate( 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) + deserialized = self._deserialize("AdminKeyResult", pipeline_response.http_response) if cls: return cls(pipeline_response, 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 5f65a3ba9374..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_network_security_perimeter_configurations_operations.py +++ /dev/null @@ -1,324 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar, Union, cast -import urllib.parse - -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.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import 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 ..._vendor import _convert_request -from ...operations._network_security_perimeter_configurations_operations import ( - build_get_request, - build_list_by_service_request, - build_reconcile_request, -) -from .._vendor import SearchManagementClientMixinABC - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class 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 = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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[int, Type[HttpResponseError]] = { - 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 = _convert_request(_request) - _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 = _convert_request(_request) - _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 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[int, Type[HttpResponseError]] = { - 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 = _convert_request(_request) - _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) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _reconcile_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_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 = _convert_request(_request) - _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 [202]: - 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")) - - if cls: - return cls(pipeline_response, None, response_headers) # 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 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( # type: ignore - 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 - ) - 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 ef36b60ab7bd..548b1baef676 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,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._operations import build_list_request -from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,7 +84,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -104,7 +99,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 index 090131cb3904..d11865a8e2ae 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -21,27 +20,24 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._private_endpoint_connections_operations import ( build_delete_request, build_get_request, build_list_by_service_request, build_update_request, ) -from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +73,7 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. .. seealso:: - https://aka.ms/search-manage @@ -85,11 +81,11 @@ async def update( :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. + :param search_service_name: The name of the 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. + 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. @@ -117,7 +113,7 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. .. seealso:: - https://aka.ms/search-manage @@ -125,11 +121,11 @@ async def update( :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. + :param search_service_name: The name of the 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. + 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. @@ -155,7 +151,7 @@ async def update( 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. + """Updates a Private Endpoint connection to the search service in the given resource group. .. seealso:: - https://aka.ms/search-manage @@ -163,11 +159,11 @@ async def update( :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. + :param search_service_name: The name of the 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. + 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. @@ -180,7 +176,7 @@ async def update( :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -219,7 +215,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -233,7 +228,7 @@ async def update( 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) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -258,11 +253,11 @@ async def get( :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. + :param search_service_name: The name of the 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. + 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: @@ -271,7 +266,7 @@ async def get( :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +294,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -313,7 +307,7 @@ async def get( 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) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -337,11 +331,11 @@ async def delete( :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. + :param search_service_name: The name of the 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. + 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: @@ -350,7 +344,7 @@ async def delete( :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -378,7 +372,6 @@ async def delete( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -394,7 +387,7 @@ async def delete( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -417,8 +410,8 @@ def list_by_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. + :param search_service_name: The name of the 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: @@ -435,7 +428,7 @@ def list_by_service( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -458,7 +451,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -474,7 +466,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 index f695fefa2666..c0b479a27a56 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_supported_request -from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,8 +70,8 @@ def list_supported( :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. + :param search_service_name: The name of the 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: @@ -90,7 +86,7 @@ def list_supported( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -113,7 +109,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -129,7 +124,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 index 981561d3b15e..484217359d97 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,26 +19,23 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._query_keys_operations import ( build_create_request, build_delete_request, build_list_by_search_service_request, ) -from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +77,8 @@ async def create( :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. + :param search_service_name: The name of the 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 @@ -93,7 +89,7 @@ async def create( :rtype: ~azure.mgmt.search.models.QueryKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -121,7 +117,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -135,7 +130,7 @@ async def create( 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) + deserialized = self._deserialize("QueryKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -150,7 +145,7 @@ def list_by_search_service( 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. + """Returns the list of query API keys for the given search service. .. seealso:: - https://aka.ms/search-manage @@ -158,8 +153,8 @@ def list_by_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. + :param search_service_name: The name of the 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: @@ -174,7 +169,7 @@ def list_by_search_service( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -197,7 +192,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -213,7 +207,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -243,7 +236,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, search_service_name: str, @@ -260,8 +253,8 @@ async def delete( # pylint: disable=inconsistent-return-statements :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. + :param search_service_name: The name of the 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. @@ -273,7 +266,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -301,7 +294,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False 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 index 546248fbbae6..9c15fa6cfd74 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,21 +17,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._search_management_client_operations import build_usage_by_subscription_sku_request from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +44,7 @@ async def usage_by_subscription_sku( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.QuotaUsageResult: - """Gets the quota usage for a search sku in the given subscription. + """Gets the quota usage for a search SKU in the given subscription. .. seealso:: - https://aka.ms/search-manage @@ -63,7 +60,7 @@ async def usage_by_subscription_sku( :rtype: ~azure.mgmt.search.models.QuotaUsageResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -90,7 +87,6 @@ async def usage_by_subscription_sku( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -104,7 +100,7 @@ async def usage_by_subscription_sku( 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) + deserialized = self._deserialize("QuotaUsageResult", pipeline_response.http_response) if cls: return cls(pipeline_response, 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 index b27035738233..3d605686161f 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,20 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import ( + Any, + AsyncIterable, + AsyncIterator, + Callable, + Dict, + IO, + Literal, + Optional, + TypeVar, + Union, + cast, + overload, +) import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +30,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -31,7 +44,6 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._services_operations import ( build_check_name_availability_request, build_create_or_update_request, @@ -41,12 +53,11 @@ build_list_by_subscription_request, build_update_request, ) -from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,8 +88,8 @@ async def _create_or_update_initial( service: Union[_models.SearchService, IO[bytes]], search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> _models.SearchService: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +102,7 @@ async def _create_or_update_initial( 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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -116,10 +127,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -127,14 +138,14 @@ async def _create_or_update_initial( 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) - if response.status_code == 200: - deserialized = self._deserialize("SearchService", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SearchService", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -161,11 +172,11 @@ async def begin_create_or_update( :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 globally unique since they are part of - the service URI (https://:code:``.search.windows.net). You cannot change the service name + :param search_service_name: The name of the 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 globally 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. @@ -202,11 +213,11 @@ async def begin_create_or_update( :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 globally unique since they are part of - the service URI (https://:code:``.search.windows.net). You cannot change the service name + :param search_service_name: The name of the 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 globally 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. @@ -241,11 +252,11 @@ async def begin_create_or_update( :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 globally unique since they are part of - the service URI (https://:code:``.search.windows.net). You cannot change the service name + :param search_service_name: The name of the 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 globally 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 @@ -281,10 +292,11 @@ async def begin_create_or_update( 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) + deserialized = self._deserialize("SearchService", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -325,7 +337,7 @@ async def update( :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. + :param search_service_name: The name of the 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 @@ -359,7 +371,7 @@ async def update( :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. + :param search_service_name: The name of the 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] @@ -391,7 +403,7 @@ async def update( :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. + :param search_service_name: The name of the 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. @@ -403,7 +415,7 @@ async def update( :rtype: ~azure.mgmt.search.models.SearchService :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +453,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -455,7 +466,7 @@ async def update( 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) + deserialized = self._deserialize("SearchService", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -478,8 +489,8 @@ async def get( :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. + :param search_service_name: The name of the 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: @@ -488,7 +499,7 @@ async def get( :rtype: ~azure.mgmt.search.models.SearchService :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -515,7 +526,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -529,7 +539,7 @@ async def get( 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) + deserialized = self._deserialize("SearchService", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -537,7 +547,7 @@ async def get( return deserialized # type: ignore @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements + async def delete( self, resource_group_name: str, search_service_name: str, @@ -552,8 +562,8 @@ async def delete( # pylint: disable=inconsistent-return-statements :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. + :param search_service_name: The name of the 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: @@ -562,7 +572,7 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -589,7 +599,6 @@ async def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -634,7 +643,7 @@ def list_by_resource_group( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -656,7 +665,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -672,7 +680,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -723,7 +730,7 @@ def list_by_subscription( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -744,7 +751,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -760,7 +766,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -797,8 +802,8 @@ async def check_name_availability( **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). + must be globally unique since they are part of the service URI (https://\\ + :code:``.search.windows.net). .. seealso:: - https://aka.ms/search-manage @@ -814,7 +819,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -845,7 +850,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -859,7 +863,7 @@ async def check_name_availability( 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) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # 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 index 88198554e1c3..ec330294cc78 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -18,12 +17,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +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 @@ -31,19 +31,17 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request 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 .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,8 +73,8 @@ async def _create_or_update_initial( shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO[bytes]], search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> Optional[_models.SharedPrivateLinkResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +87,7 @@ async def _create_or_update_initial( 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[Optional[_models.SharedPrivateLinkResource]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -115,10 +113,10 @@ async def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -126,12 +124,14 @@ async def _create_or_update_initial( 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 = None - if response.status_code == 200: - deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -159,11 +159,11 @@ async def begin_create_or_update( :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. + :param search_service_name: The name of the 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. + by the 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. @@ -201,11 +201,11 @@ async def begin_create_or_update( :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. + :param search_service_name: The name of the 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. + by the 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. @@ -241,11 +241,11 @@ async def begin_create_or_update( :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. + :param search_service_name: The name of the 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. + by the 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. @@ -282,10 +282,11 @@ async def begin_create_or_update( 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) + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -328,11 +329,11 @@ async def get( :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. + :param search_service_name: The name of the 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. + by the 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: @@ -341,7 +342,7 @@ async def get( :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -369,7 +370,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -383,22 +383,22 @@ async def get( 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) + 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( # pylint: disable=inconsistent-return-statements + 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 - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -410,7 +410,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -426,10 +426,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -437,11 +437,19 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -460,11 +468,11 @@ async def begin_delete( :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. + :param search_service_name: The name of the 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. + by the 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: @@ -482,7 +490,7 @@ async def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + 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, @@ -493,6 +501,7 @@ async def begin_delete( 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 @@ -533,8 +542,8 @@ def list_by_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. + :param search_service_name: The name of the 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: @@ -551,7 +560,7 @@ def list_by_service( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -574,7 +583,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -590,7 +598,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 index 48b7a81edbe4..3ceb114cc2cf 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -20,21 +19,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +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 ..._vendor import _convert_request from ...operations._usages_operations import build_list_by_subscription_request -from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +61,7 @@ def list_by_subscription( 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. + """Gets a list of all Search quota usages in the given subscription. .. seealso:: - https://aka.ms/search-manage @@ -85,7 +81,7 @@ def list_by_subscription( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -107,7 +103,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -123,7 +118,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 6a441c94798b..119c2d4967ae 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 @@ -5,86 +5,77 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AdminKeyResult -from ._models_py3 import AsyncOperationResult -from ._models_py3 import CheckNameAvailabilityInput -from ._models_py3 import CheckNameAvailabilityOutput -from ._models_py3 import CloudErrorBody -from ._models_py3 import DataPlaneAadOrApiKeyAuthOption -from ._models_py3 import DataPlaneAuthOptions -from ._models_py3 import EncryptionWithCmk -from ._models_py3 import Identity -from ._models_py3 import IpRule -from ._models_py3 import ListQueryKeysResult -from ._models_py3 import NSPConfigAccessRule -from ._models_py3 import NSPConfigAccessRuleProperties -from ._models_py3 import NSPConfigAssociation -from ._models_py3 import NSPConfigNetworkSecurityPerimeterRule -from ._models_py3 import NSPConfigPerimeter -from ._models_py3 import NSPConfigProfile -from ._models_py3 import NSPProvisioningIssue -from ._models_py3 import NSPProvisioningIssueProperties -from ._models_py3 import NetworkRuleSet -from ._models_py3 import NetworkSecurityPerimeterConfiguration -from ._models_py3 import NetworkSecurityPerimeterConfigurationListResult -from ._models_py3 import Operation -from ._models_py3 import OperationAvailability -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import OperationLogsSpecification -from ._models_py3 import OperationMetricDimension -from ._models_py3 import OperationMetricsSpecification -from ._models_py3 import OperationProperties -from ._models_py3 import OperationServiceSpecification -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateEndpointConnectionProperties -from ._models_py3 import PrivateEndpointConnectionPropertiesPrivateEndpoint -from ._models_py3 import PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceProperties -from ._models_py3 import PrivateLinkResourcesResult -from ._models_py3 import ProxyResource -from ._models_py3 import QueryKey -from ._models_py3 import QuotaUsageResult -from ._models_py3 import QuotaUsageResultName -from ._models_py3 import QuotaUsagesListResult -from ._models_py3 import Resource -from ._models_py3 import SearchManagementRequestOptions -from ._models_py3 import SearchService -from ._models_py3 import SearchServiceListResult -from ._models_py3 import SearchServiceUpdate -from ._models_py3 import ShareablePrivateLinkResourceProperties -from ._models_py3 import ShareablePrivateLinkResourceType -from ._models_py3 import SharedPrivateLinkResource -from ._models_py3 import SharedPrivateLinkResourceListResult -from ._models_py3 import SharedPrivateLinkResourceProperties -from ._models_py3 import Sku -from ._models_py3 import TrackedResource -from ._models_py3 import UserAssignedManagedIdentity +from typing import TYPE_CHECKING -from ._search_management_client_enums import AadAuthFailureMode -from ._search_management_client_enums import AdminKeyKind -from ._search_management_client_enums import HostingMode -from ._search_management_client_enums import IdentityType -from ._search_management_client_enums import PrivateLinkServiceConnectionProvisioningState -from ._search_management_client_enums import PrivateLinkServiceConnectionStatus -from ._search_management_client_enums import ProvisioningState -from ._search_management_client_enums import PublicNetworkAccess -from ._search_management_client_enums import SearchBypass -from ._search_management_client_enums import SearchDisabledDataExfiltrationOption -from ._search_management_client_enums import SearchEncryptionComplianceStatus -from ._search_management_client_enums import SearchEncryptionWithCmk -from ._search_management_client_enums import SearchSemanticSearch -from ._search_management_client_enums import SearchServiceStatus -from ._search_management_client_enums import SharedPrivateLinkResourceAsyncOperationResult -from ._search_management_client_enums import SharedPrivateLinkResourceProvisioningState -from ._search_management_client_enums import SharedPrivateLinkResourceStatus -from ._search_management_client_enums import SkuName -from ._search_management_client_enums import UnavailableNameReason +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AdminKeyResult, + AsyncOperationResult, + CheckNameAvailabilityInput, + CheckNameAvailabilityOutput, + CloudErrorBody, + DataPlaneAadOrApiKeyAuthOption, + DataPlaneAuthOptions, + EncryptionWithCmk, + Identity, + IpRule, + ListQueryKeysResult, + NetworkRuleSet, + Operation, + OperationDisplay, + OperationListResult, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, + PrivateEndpointConnectionPropertiesPrivateEndpoint, + PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState, + PrivateLinkResource, + PrivateLinkResourceProperties, + PrivateLinkResourcesResult, + QueryKey, + QuotaUsageResult, + QuotaUsageResultName, + QuotaUsagesListResult, + Resource, + SearchManagementRequestOptions, + SearchService, + SearchServiceListResult, + SearchServiceUpdate, + ShareablePrivateLinkResourceProperties, + ShareablePrivateLinkResourceType, + SharedPrivateLinkResource, + SharedPrivateLinkResourceListResult, + SharedPrivateLinkResourceProperties, + Sku, + TrackedResource, +) + +from ._search_management_client_enums import ( # type: ignore + AadAuthFailureMode, + AdminKeyKind, + HostingMode, + IdentityType, + PrivateLinkServiceConnectionProvisioningState, + PrivateLinkServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + SearchEncryptionComplianceStatus, + SearchEncryptionWithCmk, + SearchSemanticSearch, + SearchServiceStatus, + SharedPrivateLinkResourceAsyncOperationResult, + SharedPrivateLinkResourceProvisioningState, + SharedPrivateLinkResourceStatus, + SkuName, + UnavailableNameReason, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -99,26 +90,10 @@ "Identity", "IpRule", "ListQueryKeysResult", - "NSPConfigAccessRule", - "NSPConfigAccessRuleProperties", - "NSPConfigAssociation", - "NSPConfigNetworkSecurityPerimeterRule", - "NSPConfigPerimeter", - "NSPConfigProfile", - "NSPProvisioningIssue", - "NSPProvisioningIssueProperties", "NetworkRuleSet", - "NetworkSecurityPerimeterConfiguration", - "NetworkSecurityPerimeterConfigurationListResult", "Operation", - "OperationAvailability", "OperationDisplay", "OperationListResult", - "OperationLogsSpecification", - "OperationMetricDimension", - "OperationMetricsSpecification", - "OperationProperties", - "OperationServiceSpecification", "PrivateEndpointConnection", "PrivateEndpointConnectionListResult", "PrivateEndpointConnectionProperties", @@ -127,7 +102,6 @@ "PrivateLinkResource", "PrivateLinkResourceProperties", "PrivateLinkResourcesResult", - "ProxyResource", "QueryKey", "QuotaUsageResult", "QuotaUsageResultName", @@ -144,7 +118,6 @@ "SharedPrivateLinkResourceProperties", "Sku", "TrackedResource", - "UserAssignedManagedIdentity", "AadAuthFailureMode", "AdminKeyKind", "HostingMode", @@ -153,8 +126,6 @@ "PrivateLinkServiceConnectionStatus", "ProvisioningState", "PublicNetworkAccess", - "SearchBypass", - "SearchDisabledDataExfiltrationOption", "SearchEncryptionComplianceStatus", "SearchEncryptionWithCmk", "SearchSemanticSearch", @@ -165,5 +136,5 @@ "SkuName", "UnavailableNameReason", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/models/_models_py3.py index 8b6c06afdf14..70eea66fcae6 100644 --- 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 @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=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. @@ -15,17 +15,15 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class AdminKeyResult(_serialization.Model): - """Response containing the primary and secondary admin API keys for a given Azure AI Search - service. + """Response containing the primary and secondary admin API keys for a given search service. Variables are only populated by the server, and will be ignored when sending a request. @@ -271,18 +269,17 @@ def __init__( class EncryptionWithCmk(_serialization.Model): """Describes a policy that determines how resources within the search service are to be encrypted - with customer managed keys. + 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". + :ivar enforcement: Describes how a search service should enforce having one or more + non-customer-encrypted resources. 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". + :ivar encryption_compliance_status: Describes whether the search service is compliant or not + with respect to having non-customer-encrypted resources. If a service has more than one + non-customer-encrypted resource and 'Enforcement' is 'enabled' then the service will be marked + as 'nonCompliant'. Known values are: "Compliant" and "NonCompliant". :vartype encryption_compliance_status: str or ~azure.mgmt.search.models.SearchEncryptionComplianceStatus """ @@ -300,9 +297,8 @@ 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". + :keyword enforcement: Describes how a search service should enforce having one or more + non-customer-encrypted resources. Known values are: "Disabled", "Enabled", and "Unspecified". :paramtype enforcement: str or ~azure.mgmt.search.models.SearchEncryptionWithCmk """ super().__init__(**kwargs) @@ -311,8 +307,7 @@ def __init__( class Identity(_serialization.Model): - """Details about the search service identity. A null value indicates that the search service has - no identity assigned. + """Identity for the resource. Variables are only populated by the server, and will be ignored when sending a request. @@ -322,16 +317,8 @@ class Identity(_serialization.Model): :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". + :ivar type: The identity type. Required. Known values are: "None" and "SystemAssigned". :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}'. # pylint: disable=line-too-long - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.search.models.UserAssignedManagedIdentity] """ _validation = { @@ -344,40 +331,24 @@ class Identity(_serialization.Model): "principal_id": {"key": "principalId", "type": "str"}, "tenant_id": {"key": "tenantId", "type": "str"}, "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedManagedIdentity}"}, } - def __init__( - self, - *, - type: Union[str, "_models.IdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedManagedIdentity"]] = None, - **kwargs: Any - ) -> None: + def __init__(self, *, type: Union[str, "_models.IdentityType"], **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". + :keyword type: The identity type. Required. Known values are: "None" and "SystemAssigned". :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}'. # pylint: disable=line-too-long - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.search.models.UserAssignedManagedIdentity] """ super().__init__(**kwargs) self.principal_id = None self.tenant_id = 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. + """The IP restriction rule of the 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. + :ivar value: Value corresponding to a single IPv4 address (for example, 123.1.2.3) or an IP + range in CIDR format (for example, 123.1.2.3/24) to be allowed. :vartype value: str """ @@ -387,8 +358,8 @@ class IpRule(_serialization.Model): 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. + :keyword value: Value corresponding to a single IPv4 address (for example, 123.1.2.3) or an IP + range in CIDR format (for example, 123.1.2.3/24) to be allowed. :paramtype value: str """ super().__init__(**kwargs) @@ -396,11 +367,11 @@ def __init__(self, *, value: Optional[str] = None, **kwargs: Any) -> None: class ListQueryKeysResult(_serialization.Model): - """Response containing the query API keys for a given Azure AI Search service. + """Response containing the query API keys for a given 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. + :ivar value: The query keys for the 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. @@ -425,522 +396,27 @@ def __init__(self, **kwargs: Any) -> 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. + """Network-specific rules that determine how the search service can be reached. + + :ivar ip_rules: A list of IP restriction rules used for an IP firewall. Any IPs that do not + match the rules are blocked by the firewall. These rules are only applied when the + 'publicNetworkAccess' of the search service is 'enabled'. :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 """ _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: + def __init__(self, *, ip_rules: Optional[List["_models.IpRule"]] = 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. + :keyword ip_rules: A list of IP restriction rules used for an IP firewall. Any IPs that do not + match the rules are blocked by the firewall. These rules are only applied when the + 'publicNetworkAccess' of the search service is 'enabled'. :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", "AzurePortal", and "AzureServices". - :paramtype bypass: str or ~azure.mgmt.search.models.SearchBypass """ super().__init__(**kwargs) self.ip_rules = ip_rules - self.bypass = bypass - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - -class NetworkSecurityPerimeterConfiguration(ProxyResource): - """Network security perimeter configuration for a server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar provisioning_state: - :vartype provisioning_state: str - :ivar network_security_perimeter: The perimeter for a network security perimeter configuration. - :vartype network_security_perimeter: ~azure.mgmt.search.models.NSPConfigPerimeter - :ivar resource_association: The resource association for the network security perimeter. - :vartype resource_association: ~azure.mgmt.search.models.NSPConfigAssociation - :ivar profile: The profile for a network security perimeter configuration. - :vartype profile: ~azure.mgmt.search.models.NSPConfigProfile - :ivar provisioning_issues: - :vartype provisioning_issues: list[~azure.mgmt.search.models.NSPProvisioningIssue] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "network_security_perimeter": {"key": "properties.networkSecurityPerimeter", "type": "NSPConfigPerimeter"}, - "resource_association": {"key": "properties.resourceAssociation", "type": "NSPConfigAssociation"}, - "profile": {"key": "properties.profile", "type": "NSPConfigProfile"}, - "provisioning_issues": {"key": "properties.provisioningIssues", "type": "[NSPProvisioningIssue]"}, - } - - def __init__( - self, - *, - network_security_perimeter: Optional["_models.NSPConfigPerimeter"] = None, - resource_association: Optional["_models.NSPConfigAssociation"] = None, - profile: Optional["_models.NSPConfigProfile"] = None, - provisioning_issues: Optional[List["_models.NSPProvisioningIssue"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_security_perimeter: The perimeter for a network security perimeter - configuration. - :paramtype network_security_perimeter: ~azure.mgmt.search.models.NSPConfigPerimeter - :keyword resource_association: The resource association for the network security perimeter. - :paramtype resource_association: ~azure.mgmt.search.models.NSPConfigAssociation - :keyword profile: The profile for a network security perimeter configuration. - :paramtype profile: ~azure.mgmt.search.models.NSPConfigProfile - :keyword provisioning_issues: - :paramtype provisioning_issues: list[~azure.mgmt.search.models.NSPProvisioningIssue] - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.network_security_perimeter = network_security_perimeter - self.resource_association = resource_association - self.profile = profile - self.provisioning_issues = provisioning_issues - - -class NetworkSecurityPerimeterConfigurationListResult(_serialization.Model): # pylint: disable=name-too-long - """A list of network security perimeter configurations for a server. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.search.models.NetworkSecurityPerimeterConfiguration] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[NetworkSecurityPerimeterConfiguration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class NSPConfigAccessRule(_serialization.Model): - """An access rule for a network security perimeter configuration. - - :ivar name: - :vartype name: str - :ivar properties: The properties for the access rules in a network security perimeter - configuration. - :vartype properties: ~azure.mgmt.search.models.NSPConfigAccessRuleProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "NSPConfigAccessRuleProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - properties: Optional["_models.NSPConfigAccessRuleProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: - :paramtype name: str - :keyword properties: The properties for the access rules in a network security perimeter - configuration. - :paramtype properties: ~azure.mgmt.search.models.NSPConfigAccessRuleProperties - """ - super().__init__(**kwargs) - self.name = name - self.properties = properties - - -class NSPConfigAccessRuleProperties(_serialization.Model): - """The properties for the access rules in a network security perimeter configuration. - - :ivar direction: - :vartype direction: str - :ivar address_prefixes: - :vartype address_prefixes: list[str] - :ivar fully_qualified_domain_names: - :vartype fully_qualified_domain_names: list[str] - :ivar subscriptions: - :vartype subscriptions: list[str] - :ivar network_security_perimeters: - :vartype network_security_perimeters: - list[~azure.mgmt.search.models.NSPConfigNetworkSecurityPerimeterRule] - """ - - _attribute_map = { - "direction": {"key": "direction", "type": "str"}, - "address_prefixes": {"key": "addressPrefixes", "type": "[str]"}, - "fully_qualified_domain_names": {"key": "fullyQualifiedDomainNames", "type": "[str]"}, - "subscriptions": {"key": "subscriptions", "type": "[str]"}, - "network_security_perimeters": { - "key": "networkSecurityPerimeters", - "type": "[NSPConfigNetworkSecurityPerimeterRule]", - }, - } - - def __init__( - self, - *, - direction: Optional[str] = None, - address_prefixes: Optional[List[str]] = None, - fully_qualified_domain_names: Optional[List[str]] = None, - subscriptions: Optional[List[str]] = None, - network_security_perimeters: Optional[List["_models.NSPConfigNetworkSecurityPerimeterRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword direction: - :paramtype direction: str - :keyword address_prefixes: - :paramtype address_prefixes: list[str] - :keyword fully_qualified_domain_names: - :paramtype fully_qualified_domain_names: list[str] - :keyword subscriptions: - :paramtype subscriptions: list[str] - :keyword network_security_perimeters: - :paramtype network_security_perimeters: - list[~azure.mgmt.search.models.NSPConfigNetworkSecurityPerimeterRule] - """ - super().__init__(**kwargs) - self.direction = direction - self.address_prefixes = address_prefixes - self.fully_qualified_domain_names = fully_qualified_domain_names - self.subscriptions = subscriptions - self.network_security_perimeters = network_security_perimeters - - -class NSPConfigAssociation(_serialization.Model): - """The resource association for the network security perimeter. - - :ivar name: - :vartype name: str - :ivar access_mode: - :vartype access_mode: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_mode": {"key": "accessMode", "type": "str"}, - } - - def __init__(self, *, name: Optional[str] = None, access_mode: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: - :paramtype name: str - :keyword access_mode: - :paramtype access_mode: str - """ - super().__init__(**kwargs) - self.name = name - self.access_mode = access_mode - - -class NSPConfigNetworkSecurityPerimeterRule(_serialization.Model): - """The network security perimeter properties present in a configuration rule. - - :ivar id: - :vartype id: str - :ivar perimeter_guid: - :vartype perimeter_guid: str - :ivar location: - :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: - :paramtype id: str - :keyword perimeter_guid: - :paramtype perimeter_guid: str - :keyword location: - :paramtype location: str - """ - super().__init__(**kwargs) - self.id = id - self.perimeter_guid = perimeter_guid - self.location = location - - -class NSPConfigPerimeter(_serialization.Model): - """The perimeter for a network security perimeter configuration. - - :ivar id: - :vartype id: str - :ivar perimeter_guid: - :vartype perimeter_guid: str - :ivar location: - :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: - :paramtype id: str - :keyword perimeter_guid: - :paramtype perimeter_guid: str - :keyword location: - :paramtype location: str - """ - super().__init__(**kwargs) - self.id = id - self.perimeter_guid = perimeter_guid - self.location = location - - -class NSPConfigProfile(_serialization.Model): - """The profile for a network security perimeter configuration. - - :ivar name: - :vartype name: str - :ivar access_rules_version: - :vartype access_rules_version: str - :ivar access_rules: - :vartype access_rules: list[~azure.mgmt.search.models.NSPConfigAccessRule] - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_rules_version": {"key": "accessRulesVersion", "type": "str"}, - "access_rules": {"key": "accessRules", "type": "[NSPConfigAccessRule]"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - access_rules_version: Optional[str] = None, - access_rules: Optional[List["_models.NSPConfigAccessRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: - :paramtype name: str - :keyword access_rules_version: - :paramtype access_rules_version: str - :keyword access_rules: - :paramtype access_rules: list[~azure.mgmt.search.models.NSPConfigAccessRule] - """ - super().__init__(**kwargs) - self.name = name - self.access_rules_version = access_rules_version - self.access_rules = access_rules - - -class NSPProvisioningIssue(_serialization.Model): - """An object to describe any issues with provisioning network security perimeters to a search - service. - - :ivar name: - :vartype name: str - :ivar properties: The properties to describe any issues with provisioning network security - perimeters to a search service. - :vartype properties: ~azure.mgmt.search.models.NSPProvisioningIssueProperties - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "properties": {"key": "properties", "type": "NSPProvisioningIssueProperties"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - properties: Optional["_models.NSPProvisioningIssueProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: - :paramtype name: str - :keyword properties: The properties to describe any issues with provisioning network security - perimeters to a search service. - :paramtype properties: ~azure.mgmt.search.models.NSPProvisioningIssueProperties - """ - super().__init__(**kwargs) - self.name = name - self.properties = properties - - -class NSPProvisioningIssueProperties(_serialization.Model): - """The properties to describe any issues with provisioning network security perimeters to a search - service. - - :ivar issue_type: - :vartype issue_type: str - :ivar severity: - :vartype severity: str - :ivar description: - :vartype description: str - :ivar suggested_resource_ids: - :vartype suggested_resource_ids: list[str] - :ivar suggested_access_rules: - :vartype suggested_access_rules: list[str] - """ - - _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": "[str]"}, - } - - def __init__( - self, - *, - issue_type: Optional[str] = None, - severity: Optional[str] = None, - description: Optional[str] = None, - suggested_resource_ids: Optional[List[str]] = None, - suggested_access_rules: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword issue_type: - :paramtype issue_type: str - :keyword severity: - :paramtype severity: str - :keyword description: - :paramtype description: str - :keyword suggested_resource_ids: - :paramtype suggested_resource_ids: list[str] - :keyword suggested_access_rules: - :paramtype suggested_access_rules: list[str] - """ - super().__init__(**kwargs) - self.issue_type = issue_type - self.severity = severity - self.description = description - self.suggested_resource_ids = suggested_resource_ids - self.suggested_access_rules = suggested_access_rules class Operation(_serialization.Model): @@ -953,29 +429,16 @@ class Operation(_serialization.Model): :vartype name: str :ivar display: The object that describes the operation. :vartype display: ~azure.mgmt.search.models.OperationDisplay - :ivar is_data_action: Describes if the specified operation is a data plane API operation. - Operations where this value is not true are supported directly by the resource provider. - :vartype is_data_action: bool - :ivar origin: Describes which originating entities are allowed to invoke this operation. - :vartype origin: str - :ivar properties: Describes additional properties for this operation. - :vartype properties: ~azure.mgmt.search.models.OperationProperties """ _validation = { "name": {"readonly": True}, "display": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "properties": {"readonly": True}, } _attribute_map = { "name": {"key": "name", "type": "str"}, "display": {"key": "display", "type": "OperationDisplay"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "origin": {"key": "origin", "type": "str"}, - "properties": {"key": "properties", "type": "OperationProperties"}, } def __init__(self, **kwargs: Any) -> None: @@ -983,37 +446,6 @@ def __init__(self, **kwargs: Any) -> None: super().__init__(**kwargs) self.name = None self.display = None - self.is_data_action = None - self.origin = None - self.properties = None - - -class OperationAvailability(_serialization.Model): - """Describes a particular availability for the metric specification. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar time_grain: The time grain for the dimension. - :vartype time_grain: str - :ivar blob_duration: The blob duration for the dimension. - :vartype blob_duration: str - """ - - _validation = { - "time_grain": {"readonly": True}, - "blob_duration": {"readonly": True}, - } - - _attribute_map = { - "time_grain": {"key": "timeGrain", "type": "str"}, - "blob_duration": {"key": "blobDuration", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.time_grain = None - self.blob_duration = None class OperationDisplay(_serialization.Model): @@ -1060,8 +492,7 @@ class OperationListResult(_serialization.Model): 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. + :ivar value: The list of operations supported by the resource provider. :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 @@ -1084,173 +515,43 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class OperationLogsSpecification(_serialization.Model): - """Specifications of one type of log for this operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the log specification. - :vartype name: str - :ivar display_name: The display name of the log specification. - :vartype display_name: str - :ivar blob_duration: The blob duration for the log specification. - :vartype blob_duration: str - """ - - _validation = { - "name": {"readonly": True}, - "display_name": {"readonly": True}, - "blob_duration": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "blob_duration": {"key": "blobDuration", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.display_name = None - self.blob_duration = None - - -class OperationMetricDimension(_serialization.Model): - """Describes a particular dimension for the metric specification. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the dimension. - :vartype name: str - :ivar display_name: The display name of the dimension. - :vartype display_name: str - """ - - _validation = { - "name": {"readonly": True}, - "display_name": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.display_name = None - - -class OperationMetricsSpecification(_serialization.Model): - """Specifications of one type of metric for this operation. +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 name: The name of the metric specification. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. :vartype name: str - :ivar display_name: The display name of the metric specification. - :vartype display_name: str - :ivar display_description: The display description of the metric specification. - :vartype display_description: str - :ivar unit: The unit for the metric specification. - :vartype unit: str - :ivar aggregation_type: The type of aggregation for the metric specification. - :vartype aggregation_type: str - :ivar dimensions: Dimensions for the metric specification. - :vartype dimensions: list[~azure.mgmt.search.models.OperationMetricDimension] - :ivar availabilities: Availabilities for the metric specification. - :vartype availabilities: list[~azure.mgmt.search.models.OperationAvailability] + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str """ _validation = { + "id": {"readonly": True}, "name": {"readonly": True}, - "display_name": {"readonly": True}, - "display_description": {"readonly": True}, - "unit": {"readonly": True}, - "aggregation_type": {"readonly": True}, - "dimensions": {"readonly": True}, - "availabilities": {"readonly": True}, + "type": {"readonly": True}, } _attribute_map = { + "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, - "display_name": {"key": "displayName", "type": "str"}, - "display_description": {"key": "displayDescription", "type": "str"}, - "unit": {"key": "unit", "type": "str"}, - "aggregation_type": {"key": "aggregationType", "type": "str"}, - "dimensions": {"key": "dimensions", "type": "[OperationMetricDimension]"}, - "availabilities": {"key": "availabilities", "type": "[OperationAvailability]"}, + "type": {"key": "type", "type": "str"}, } def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) + self.id = None self.name = None - self.display_name = None - self.display_description = None - self.unit = None - self.aggregation_type = None - self.dimensions = None - self.availabilities = None - - -class OperationProperties(_serialization.Model): - """Describes additional properties for this operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar service_specification: Specifications of the service for this operation. - :vartype service_specification: ~azure.mgmt.search.models.OperationServiceSpecification - """ - - _validation = { - "service_specification": {"readonly": True}, - } - - _attribute_map = { - "service_specification": {"key": "serviceSpecification", "type": "OperationServiceSpecification"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.service_specification = None - - -class OperationServiceSpecification(_serialization.Model): - """Specifications of the service for this operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar metric_specifications: Specifications of metrics for this operation. - :vartype metric_specifications: list[~azure.mgmt.search.models.OperationMetricsSpecification] - :ivar log_specifications: Specifications of logs for this operation. - :vartype log_specifications: list[~azure.mgmt.search.models.OperationLogsSpecification] - """ - - _validation = { - "metric_specifications": {"readonly": True}, - "log_specifications": {"readonly": True}, - } - - _attribute_map = { - "metric_specifications": {"key": "metricSpecifications", "type": "[OperationMetricsSpecification]"}, - "log_specifications": {"key": "logSpecifications", "type": "[OperationLogsSpecification]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.metric_specifications = None - self.log_specifications = None + self.type = None class PrivateEndpointConnection(Resource): - """Describes an existing private endpoint connection to the Azure AI Search service. + """Describes an existing private endpoint connection to the search service. Variables are only populated by the server, and will be ignored when sending a request. @@ -1263,7 +564,7 @@ class PrivateEndpointConnection(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar properties: Describes the properties of an existing private endpoint connection to the - Azure AI Search service. + search service. :vartype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties """ @@ -1285,7 +586,7 @@ def __init__( ) -> None: """ :keyword properties: Describes the properties of an existing private endpoint connection to the - Azure AI Search service. + search service. :paramtype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties """ super().__init__(**kwargs) @@ -1293,11 +594,11 @@ def __init__( class PrivateEndpointConnectionListResult(_serialization.Model): - """Response containing a list of private endpoint connections. + """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. + :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 @@ -1323,20 +624,21 @@ def __init__(self, **kwargs: Any) -> None: class PrivateEndpointConnectionProperties(_serialization.Model): - """Describes the properties of an existing private endpoint connection to the search service. + """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. + :ivar private_link_service_connection_state: Describes the current state of an existing Private + Link Service connection to the Azure 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. + :ivar group_id: The group id from the provider of resource the private link service connection + 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". + values are Updating, Deleting, Failed, Succeeded, or Incomplete. Known values are: "Updating", + "Deleting", "Failed", "Succeeded", "Incomplete", and "Canceled". :vartype provisioning_state: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState """ @@ -1367,15 +669,15 @@ def __init__( :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. + Private Link Service connection to the Azure 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. + :keyword group_id: The group id from the provider of resource the private link service + connection 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". + Valid values are Updating, Deleting, Failed, Succeeded, or Incomplete. Known values are: + "Updating", "Deleting", "Failed", "Succeeded", "Incomplete", and "Canceled". :paramtype provisioning_state: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState """ @@ -1389,7 +691,7 @@ def __init__( 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. + :ivar id: The resource id of the private endpoint resource from Microsoft.Network provider. :vartype id: str """ @@ -1399,7 +701,7 @@ class PrivateEndpointConnectionPropertiesPrivateEndpoint(_serialization.Model): 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. + :keyword id: The resource id of the private endpoint resource from Microsoft.Network provider. :paramtype id: str """ super().__init__(**kwargs) @@ -1409,8 +711,8 @@ def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylin 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. + """Describes the current state of an existing Private Link Service connection to the Azure 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 @@ -1453,7 +755,7 @@ def __init__( class PrivateLinkResource(Resource): - """Describes a supported private link resource for the Azure AI Search service. + """Describes a supported private link resource for the search service. Variables are only populated by the server, and will be ignored when sending a request. @@ -1465,8 +767,8 @@ class PrivateLinkResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar properties: Describes the properties of a supported private link resource for the Azure - AI Search service. + :ivar properties: Describes the properties of a supported private link resource for the search + service. :vartype properties: ~azure.mgmt.search.models.PrivateLinkResourceProperties """ @@ -1491,9 +793,9 @@ def __init__(self, **kwargs: Any) -> 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. + """Describes the properties of a supported private link resource for the 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. @@ -1504,7 +806,7 @@ class PrivateLinkResourceProperties(_serialization.Model): :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. + private link service and that are supported by search. :vartype shareable_private_link_resource_types: list[~azure.mgmt.search.models.ShareablePrivateLinkResourceType] """ @@ -1559,13 +861,11 @@ def __init__(self, **kwargs: Any) -> 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. + """Describes an API key for a given search service that has permissions for query operations only. 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. + :ivar name: The name of the query API key; may be empty. :vartype name: str :ivar key: The value of the query API key. :vartype key: str @@ -1770,8 +1070,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class SearchService(TrackedResource): # pylint: disable=too-many-instance-attributes - """Describes an Azure AI Search service and its current state. +class SearchService(TrackedResource): + """Describes a search service and its current state. Variables are only populated by the server, and will be ignored when sending a request. @@ -1789,8 +1089,8 @@ class SearchService(TrackedResource): # pylint: disable=too-many-instance-attri :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. + :ivar sku: The SKU of the search service, which determines billing rate 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 @@ -1819,33 +1119,26 @@ class SearchService(TrackedResource): # pylint: disable=too-many-instance-attri 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 + state. If your service is in the degraded, disabled, or error states, Microsoft 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". + "deleting", "degraded", "disabled", and "error". :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 + 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". + '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. + :ivar network_rule_set: Network-specific rules that determine how the search service may be + reached. :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet - :ivar disabled_data_exfiltration_options: 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 disabled_data_exfiltration_options: list[str or - ~azure.mgmt.search.models.SearchDisabledDataExfiltrationOption] :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 @@ -1856,21 +1149,18 @@ class SearchService(TrackedResource): # pylint: disable=too-many-instance-attri :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. + :ivar private_endpoint_connections: The list of private endpoint connections to the search + service. :vartype private_endpoint_connections: list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar semantic_search: Sets options that control the availability of semantic search. This + configuration is only possible for certain search SKUs in certain locations. Known values are: + "disabled", "free", and "standard". + :vartype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch :ivar shared_private_link_resources: The list of shared private link resources managed by the - Azure AI Search service. + 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 """ _validation = { @@ -1885,7 +1175,6 @@ class SearchService(TrackedResource): # pylint: disable=too-many-instance-attri "provisioning_state": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, "shared_private_link_resources": {"readonly": True}, - "e_tag": {"readonly": True}, } _attribute_map = { @@ -1904,20 +1193,18 @@ class SearchService(TrackedResource): # pylint: disable=too-many-instance-attri "status_details": {"key": "properties.statusDetails", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "network_rule_set": {"key": "properties.networkRuleSet", "type": "NetworkRuleSet"}, - "disabled_data_exfiltration_options": {"key": "properties.disabledDataExfiltrationOptions", "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]", }, + "semantic_search": {"key": "properties.semanticSearch", "type": "str"}, "shared_private_link_resources": { "key": "properties.sharedPrivateLinkResources", "type": "[SharedPrivateLinkResource]", }, - "e_tag": {"key": "properties.eTag", "type": "str"}, } def __init__( @@ -1932,9 +1219,6 @@ def __init__( hosting_mode: Union[str, "_models.HostingMode"] = "default", public_network_access: Union[str, "_models.PublicNetworkAccess"] = "enabled", network_rule_set: Optional["_models.NetworkRuleSet"] = None, - disabled_data_exfiltration_options: Optional[ - List[Union[str, "_models.SearchDisabledDataExfiltrationOption"]] - ] = None, encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, disable_local_auth: Optional[bool] = None, auth_options: Optional["_models.DataPlaneAuthOptions"] = None, @@ -1946,7 +1230,7 @@ def __init__( :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. + :keyword sku: The SKU of the search service, which determines billing rate 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. @@ -1971,15 +1255,9 @@ def __init__( is not allowed, and private endpoint connections would be the exclusive access method. Known values are: "enabled" and "disabled". :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. + :keyword network_rule_set: Network-specific rules that determine how the search service may be + reached. :paramtype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet - :keyword disabled_data_exfiltration_options: 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 disabled_data_exfiltration_options: list[str or - ~azure.mgmt.search.models.SearchDisabledDataExfiltrationOption] :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 @@ -1991,8 +1269,8 @@ def __init__( 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". + configuration is only possible for certain search SKUs in certain locations. Known values are: + "disabled", "free", and "standard". :paramtype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch """ super().__init__(tags=tags, location=location, **kwargs) @@ -2006,18 +1284,16 @@ def __init__( self.status_details = None self.provisioning_state = None self.network_rule_set = network_rule_set - self.disabled_data_exfiltration_options = disabled_data_exfiltration_options 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 = None + self.semantic_search = semantic_search self.shared_private_link_resources = None - self.e_tag = None class SearchServiceListResult(_serialization.Model): - """Response containing a list of Azure AI Search services. + """Response containing a list of search services. Variables are only populated by the server, and will be ignored when sending a request. @@ -2045,8 +1321,8 @@ def __init__(self, **kwargs: Any) -> None: self.next_link = None -class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attributes - """The parameters used to update an Azure AI Search service. +class SearchServiceUpdate(Resource): + """The parameters used to update a search service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2058,8 +1334,8 @@ class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attrib :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: 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. + :ivar sku: The SKU of the search service, which determines the billing rate 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). @@ -2067,8 +1343,7 @@ class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attrib :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. + :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. @@ -2095,33 +1370,26 @@ class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attrib 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 + state. If your service is in the degraded, disabled, or error states, Microsoft 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". + "deleting", "degraded", "disabled", and "error". :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 + 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". + '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. + :ivar network_rule_set: Network-specific rules that determine how the search service may be + reached. :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet - :ivar disabled_data_exfiltration_options: 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 disabled_data_exfiltration_options: list[str or - ~azure.mgmt.search.models.SearchDisabledDataExfiltrationOption] :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 @@ -2132,21 +1400,18 @@ class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attrib :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. + :ivar private_endpoint_connections: The list of private endpoint connections to the search + service. :vartype private_endpoint_connections: list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar semantic_search: Sets options that control the availability of semantic search. This + configuration is only possible for certain search SKUs in certain locations. Known values are: + "disabled", "free", and "standard". + :vartype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch :ivar shared_private_link_resources: The list of shared private link resources managed by the - Azure AI Search service. + 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 """ _validation = { @@ -2160,7 +1425,6 @@ class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attrib "provisioning_state": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, "shared_private_link_resources": {"readonly": True}, - "e_tag": {"readonly": True}, } _attribute_map = { @@ -2179,20 +1443,18 @@ class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attrib "status_details": {"key": "properties.statusDetails", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "network_rule_set": {"key": "properties.networkRuleSet", "type": "NetworkRuleSet"}, - "disabled_data_exfiltration_options": {"key": "properties.disabledDataExfiltrationOptions", "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]", }, + "semantic_search": {"key": "properties.semanticSearch", "type": "str"}, "shared_private_link_resources": { "key": "properties.sharedPrivateLinkResources", "type": "[SharedPrivateLinkResource]", }, - "e_tag": {"key": "properties.eTag", "type": "str"}, } def __init__( @@ -2207,9 +1469,6 @@ def __init__( hosting_mode: Union[str, "_models.HostingMode"] = "default", public_network_access: Union[str, "_models.PublicNetworkAccess"] = "enabled", network_rule_set: Optional["_models.NetworkRuleSet"] = None, - disabled_data_exfiltration_options: Optional[ - List[Union[str, "_models.SearchDisabledDataExfiltrationOption"]] - ] = None, encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, disable_local_auth: Optional[bool] = None, auth_options: Optional["_models.DataPlaneAuthOptions"] = None, @@ -2217,8 +1476,8 @@ def __init__( **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. + :keyword sku: The SKU of the search service, which determines the billing rate 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). @@ -2226,8 +1485,7 @@ def __init__( :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. + :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 @@ -2249,15 +1507,9 @@ def __init__( is not allowed, and private endpoint connections would be the exclusive access method. Known values are: "enabled" and "disabled". :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. + :keyword network_rule_set: Network-specific rules that determine how the search service may be + reached. :paramtype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet - :keyword disabled_data_exfiltration_options: 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 disabled_data_exfiltration_options: list[str or - ~azure.mgmt.search.models.SearchDisabledDataExfiltrationOption] :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 @@ -2269,8 +1521,8 @@ def __init__( 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". + configuration is only possible for certain search SKUs in certain locations. Known values are: + "disabled", "free", and "standard". :paramtype semantic_search: str or ~azure.mgmt.search.models.SearchSemanticSearch """ super().__init__(**kwargs) @@ -2286,30 +1538,28 @@ def __init__( self.status_details = None self.provisioning_state = None self.network_rule_set = network_rule_set - self.disabled_data_exfiltration_options = disabled_data_exfiltration_options 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 = None + self.semantic_search = semantic_search self.shared_private_link_resources = None - self.e_tag = 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. + """Describes the properties of a resource type that has been onboarded to private link service and + that's supported by 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. + service and that's supported by 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. + private link service and that's supported by 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. + service and that's supported by search. :vartype description: str """ @@ -2334,16 +1584,16 @@ def __init__(self, **kwargs: Any) -> None: class ShareablePrivateLinkResourceType(_serialization.Model): - """Describes an resource type that has been onboarded to private link service, supported by Azure - AI Search. + """Describes a resource type that has been onboarded to private link service and that's supported + by 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. + :ivar name: The name of the resource type that has been onboarded to private link service and + that's supported by 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. + private link service and that's supported by search. :vartype properties: ~azure.mgmt.search.models.ShareablePrivateLinkResourceProperties """ @@ -2365,7 +1615,7 @@ def __init__(self, **kwargs: Any) -> None: class SharedPrivateLinkResource(Resource): - """Describes a shared private link resource managed by the Azure AI Search service. + """Describes a Shared Private Link Resource managed by the search service. Variables are only populated by the server, and will be ignored when sending a request. @@ -2377,8 +1627,8 @@ class SharedPrivateLinkResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar properties: Describes the properties of a shared private link resource managed by the - Azure AI Search service. + :ivar properties: Describes the properties of a Shared Private Link Resource managed by the + search service. :vartype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties """ @@ -2399,8 +1649,8 @@ 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. + :keyword properties: Describes the properties of a Shared Private Link Resource managed by the + search service. :paramtype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties """ super().__init__(**kwargs) @@ -2408,11 +1658,11 @@ def __init__( class SharedPrivateLinkResourceListResult(_serialization.Model): - """Response containing a list of shared private link resources. + """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. + :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. @@ -2440,19 +1690,20 @@ def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: class SharedPrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of an existing shared private link resource managed by the Azure AI - Search service. + """Describes the properties of an existing Shared Private Link Resource managed by the search + service. - :ivar private_link_resource_id: The resource ID of the resource the shared private link + :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 + :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. + :ivar request_message: The request 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 + the resource to which a shared private link is to be 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, @@ -2487,17 +1738,17 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword private_link_resource_id: The resource ID of the resource the shared private link + :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 + :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. + :keyword request_message: The request 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 + of the resource to which a shared private link is to be 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, @@ -2553,31 +1804,3 @@ def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kw """ super().__init__(**kwargs) self.name = name - - -class UserAssignedManagedIdentity(_serialization.Model): - """The details of the user assigned managed identity assigned to the search service. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of user 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 = None - self.client_id = None 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/_search_management_client_enums.py index 01e586512724..9d69731b9738 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/_search_management_client_enums.py @@ -46,25 +46,15 @@ class HostingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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. - """ + """The identity type.""" NONE = "None" - """Indicates that any identity associated with the search service needs to be removed.""" SYSTEM_ASSIGNED = "SystemAssigned" - """Indicates that system-assigned identity for the search service will be enabled.""" - USER_ASSIGNED = "UserAssigned" - """Indicates that one or more user assigned identities will be assigned to the search service.""" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" - """Indicates that system-assigned identity for the search service will be enabled along with the - assignment of one or more user assigned identities.""" class PrivateLinkServiceConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the private link service connection. Valid values are Updating, - Deleting, Failed, Succeeded, Incomplete, or Canceled. + Deleting, Failed, Succeeded, or Incomplete. """ UPDATING = "Updating" @@ -80,7 +70,7 @@ class PrivateLinkServiceConnectionProvisioningState(str, Enum, metaclass=CaseIns """Provisioning request for the private link service connection resource has been accepted but the process of creation has not commenced yet.""" CANCELED = "Canceled" - """Provisioning request for the private link service connection resource has been canceled.""" + """Provisioning request for the private link service connection resource has been canceled""" class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -101,18 +91,18 @@ class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnu class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """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 + 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 + 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. """ - SUCCEEDED = "Succeeded" + SUCCEEDED = "succeeded" """The last provisioning operation has completed successfully.""" - PROVISIONING = "Provisioning" + PROVISIONING = "provisioning" """The search service is being provisioned or scaled up or down.""" - FAILED = "Failed" + FAILED = "failed" """The last provisioning operation has failed.""" @@ -123,76 +113,51 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ ENABLED = "enabled" - """The search service is accessible from traffic originating from the public internet.""" DISABLED = "disabled" - """The search service is not accessible from traffic originating from the public internet. Access - is only permitted over approved private endpoint connections.""" - - -class SearchBypass(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Possible origins of inbound traffic that can bypass the rules defined in the 'ipRules' section.""" - - 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.""" - - -class SearchDisabledDataExfiltrationOption(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A specific data exfiltration scenario that is disabled for the service.""" - - ALL = "All" - """Indicates that all data exfiltration scenarios are disabled.""" class SearchEncryptionComplianceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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. + """Describes whether the search service is compliant or not with respect to having + non-customer-encrypted resources. If a service has more than one non-customer-encrypted + resource and 'Enforcement' is 'enabled' then the service will be marked as 'nonCompliant'. """ COMPLIANT = "Compliant" - """Indicates that the search service is compliant, either because the number of non-CMK-encrypted - objects is zero or enforcement is disabled.""" + """Indicates that the search service is compliant, either because number of non-customer-encrypted + resources is zero or enforcement is disabled.""" NON_COMPLIANT = "NonCompliant" - """Indicates that the search service has more than one non-CMK-encrypted objects.""" + """Indicates that the search service has more than one non-customer-encrypted resources.""" class SearchEncryptionWithCmk(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Describes how a search service should enforce compliance if it finds objects that aren't - encrypted with the customer-managed key. + """Describes how a search service should enforce having one or more non-customer-encrypted + resources. """ DISABLED = "Disabled" - """No enforcement of customer-managed key encryption will be made. Only the built-in - service-managed encryption is used.""" + """No enforcement will be made and the search service can have non-customer-encrypted resources.""" ENABLED = "Enabled" - """Search service will be marked as non-compliant if one or more objects aren't encrypted with a - customer-managed key.""" + """Search service will be marked as non-compliant if there are one or more non-customer-encrypted + resources.""" UNSPECIFIED = "Unspecified" """Enforcement policy is not explicitly specified, with the behavior being the same as if it were set to 'Disabled'.""" 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. + """Sets options that control the availability of semantic ranking. This configuration is only + possible for certain search SKUs in certain locations. """ DISABLED = "disabled" - """Indicates that semantic reranker is disabled for the search service. This is the default.""" + """Indicates that semantic ranking 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.""" + """Enables semantic ranking on a search service and indicates that it is to be used within the + limits of the free tier. This would cap the volume of semantic ranking requests and is offered + at no extra charge. This is the default for newly provisioned search services.""" STANDARD = "standard" - """Enables semantic reranker on a search service as a billable feature, with higher throughput and - volume of semantically reranked queries.""" + """Enables semantic ranking on a search service as a billable feature, with higher throughput and + volume of semantic ranking requests.""" class SearchServiceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -202,11 +167,10 @@ class SearchServiceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): '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. + service will reject all API requests. 'error': The search service is in an error state. If your + service is in the degraded, disabled, or error states, Microsoft is actively investigating the + underlying issue. Dedicated services in these states are still chargeable based on the number + of search units provisioned. """ RUNNING = "running" @@ -222,8 +186,6 @@ class SearchServiceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): ERROR = "error" """The search service is in error state, indicating either a failure to provision or to be deleted.""" - STOPPED = "stopped" - """The search service is in a subscription that's disabled.""" class SharedPrivateLinkResourceAsyncOperationResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -240,17 +202,10 @@ class SharedPrivateLinkResourceProvisioningState(str, Enum, metaclass=CaseInsens """ UPDATING = "Updating" - """The shared private link resource is in the process of being created along with other resources - for it to be fully functional.""" DELETING = "Deleting" - """The shared private link resource is in the process of being deleted.""" FAILED = "Failed" - """The shared private link resource has failed to be provisioned or deleted.""" SUCCEEDED = "Succeeded" - """The shared private link resource has finished provisioning and is ready for approval.""" INCOMPLETE = "Incomplete" - """Provisioning request for the shared private link resource has been accepted but the process of - creation has not commenced yet.""" class SharedPrivateLinkResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -259,13 +214,9 @@ class SharedPrivateLinkResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMe """ PENDING = "Pending" - """The shared private link resource has been created and is pending approval.""" APPROVED = "Approved" - """The shared private link resource is approved and is ready for use.""" REJECTED = "Rejected" - """The shared private link resource has been rejected and cannot be used.""" DISCONNECTED = "Disconnected" - """The shared private link resource has been removed from the service.""" class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -302,6 +253,6 @@ class UnavailableNameReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ INVALID = "Invalid" - """The search service name doesn't match naming requirements.""" + """The search service name does not match naming requirements.""" ALREADY_EXISTS = "AlreadyExists" """The search service name is already assigned to a different search service.""" 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 57f8554fb6d4..cd9098b83bd2 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 @@ -5,20 +5,25 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._admin_keys_operations import AdminKeysOperations -from ._query_keys_operations import QueryKeysOperations -from ._services_operations import ServicesOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations -from ._usages_operations import UsagesOperations -from ._search_management_client_operations import SearchManagementClientOperationsMixin -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +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 ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -31,7 +36,6 @@ "SharedPrivateLinkResourcesOperations", "UsagesOperations", "SearchManagementClientOperationsMixin", - "NetworkSecurityPerimeterConfigurationsOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/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 index f4535df863f4..a9f734a9ab96 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,18 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +47,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,9 +57,7 @@ def build_get_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -91,7 +86,7 @@ def build_regenerate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -101,9 +96,7 @@ def build_regenerate_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "keyKind": _SERIALIZER.url("key_kind", key_kind, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -148,7 +141,7 @@ def get( 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. + """Gets the primary and secondary admin API keys for the specified search service. .. seealso:: - https://aka.ms/search-manage @@ -156,8 +149,8 @@ def get( :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. + :param search_service_name: The name of the 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: @@ -166,7 +159,7 @@ def get( :rtype: ~azure.mgmt.search.models.AdminKeyResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +186,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -207,7 +199,7 @@ def get( 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) + deserialized = self._deserialize("AdminKeyResult", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -232,8 +224,8 @@ def regenerate( :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. + :param search_service_name: The name of the 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. @@ -245,7 +237,7 @@ def regenerate( :rtype: ~azure.mgmt.search.models.AdminKeyResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +265,6 @@ def regenerate( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -287,7 +278,7 @@ def regenerate( 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) + deserialized = self._deserialize("AdminKeyResult", pipeline_response.http_response) if cls: return cls(pipeline_response, 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 f82e60c17bd6..000000000000 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_network_security_perimeter_configurations_operations.py +++ /dev/null @@ -1,436 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar, Union, cast -import urllib.parse - -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.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import 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 azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations", - ) # pylint: disable=line-too-long - 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", "2024-06-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/networkSecurityPerimeterConfigurations/{nspConfigName}", - ) # pylint: disable=line-too-long - 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", "2024-06-01-preview")) - 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", - ) # pylint: disable=line-too-long - 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 = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @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[int, Type[HttpResponseError]] = { - 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 = _convert_request(_request) - _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 = _convert_request(_request) - _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 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[int, Type[HttpResponseError]] = { - 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 = _convert_request(_request) - _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) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _reconcile_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, search_service_name: str, nsp_config_name: str, **kwargs: Any - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_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 = _convert_request(_request) - _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 [202]: - 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")) - - if cls: - return cls(pipeline_response, None, response_headers) # 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 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( # type: ignore - 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 - ) - 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 060d196aa209..2369497314c1 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,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,7 +90,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -109,7 +106,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -125,7 +121,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 index 6439c82c4bc7..bc041c8fc638 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -21,20 +20,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +51,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + 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") @@ -65,9 +62,7 @@ def build_update_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -101,7 +96,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,9 +106,7 @@ def build_get_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -145,7 +138,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,9 +148,7 @@ def build_delete_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -188,7 +179,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -199,9 +190,7 @@ def build_list_by_service_request( 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -248,7 +237,7 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. .. seealso:: - https://aka.ms/search-manage @@ -256,11 +245,11 @@ def update( :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. + :param search_service_name: The name of the 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. + 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. @@ -288,7 +277,7 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a private endpoint connection to the search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. .. seealso:: - https://aka.ms/search-manage @@ -296,11 +285,11 @@ def update( :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. + :param search_service_name: The name of the 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. + 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. @@ -326,7 +315,7 @@ def update( 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. + """Updates a Private Endpoint connection to the search service in the given resource group. .. seealso:: - https://aka.ms/search-manage @@ -334,11 +323,11 @@ def update( :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. + :param search_service_name: The name of the 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. + 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. @@ -351,7 +340,7 @@ def update( :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,7 +379,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -404,7 +392,7 @@ def update( 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) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -429,11 +417,11 @@ def get( :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. + :param search_service_name: The name of the 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. + 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: @@ -442,7 +430,7 @@ def get( :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +458,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -484,7 +471,7 @@ def get( 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) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -508,11 +495,11 @@ def delete( :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. + :param search_service_name: The name of the 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. + 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: @@ -521,7 +508,7 @@ def delete( :rtype: ~azure.mgmt.search.models.PrivateEndpointConnection or None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -549,7 +536,6 @@ def delete( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -565,7 +551,7 @@ def delete( deserialized = None if response.status_code == 200: - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -588,8 +574,8 @@ def list_by_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. + :param search_service_name: The name of the 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: @@ -605,7 +591,7 @@ def list_by_service( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -628,7 +614,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -644,7 +629,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 index 8a7a73f608f1..efbefae85b58 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +49,7 @@ def build_list_supported_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,9 +60,7 @@ def build_list_supported_request( 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -116,8 +111,8 @@ def list_supported( :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. + :param search_service_name: The name of the 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: @@ -132,7 +127,7 @@ def list_supported( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -155,7 +150,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -171,7 +165,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 index bca4bbc51daa..9b508b407212 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +50,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,9 +60,7 @@ def build_create_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "name": _SERIALIZER.url("name", name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -94,7 +89,7 @@ def build_list_by_search_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,9 +99,7 @@ def build_list_by_search_service_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -135,7 +128,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -145,9 +138,7 @@ def build_delete_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "key": _SERIALIZER.url("key", key, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -202,8 +193,8 @@ def create( :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. + :param search_service_name: The name of the 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 @@ -214,7 +205,7 @@ def create( :rtype: ~azure.mgmt.search.models.QueryKey :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -242,7 +233,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -256,7 +246,7 @@ def create( 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) + deserialized = self._deserialize("QueryKey", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -271,7 +261,7 @@ def list_by_search_service( 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. + """Returns the list of query API keys for the given search service. .. seealso:: - https://aka.ms/search-manage @@ -279,8 +269,8 @@ def list_by_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. + :param search_service_name: The name of the 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: @@ -295,7 +285,7 @@ def list_by_search_service( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,7 +308,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -334,7 +323,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -381,8 +369,8 @@ def delete( # pylint: disable=inconsistent-return-statements :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. + :param search_service_name: The name of the 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. @@ -394,7 +382,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +410,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False 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 index 84b13d102918..e43edc959d3a 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -18,20 +17,19 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request +from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +43,7 @@ def build_usage_by_subscription_sku_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +80,7 @@ def usage_by_subscription_sku( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.QuotaUsageResult: - """Gets the quota usage for a search sku in the given subscription. + """Gets the quota usage for a search SKU in the given subscription. .. seealso:: - https://aka.ms/search-manage @@ -98,7 +96,7 @@ def usage_by_subscription_sku( :rtype: ~azure.mgmt.search.models.QuotaUsageResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -125,7 +123,6 @@ def usage_by_subscription_sku( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -139,7 +136,7 @@ def usage_by_subscription_sku( 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) + deserialized = self._deserialize("QuotaUsageResult", pipeline_response.http_response) if cls: return cls(pipeline_response, 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 index 9789a2ca3659..52ec0e120bed 100644 --- 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +17,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 @@ -31,12 +32,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +55,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + 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") @@ -96,7 +96,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + 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") @@ -137,7 +137,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -147,9 +147,7 @@ def build_get_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -177,7 +175,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -187,9 +185,7 @@ def build_delete_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -212,7 +208,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -244,7 +240,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -272,10 +268,9 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + 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") - type = "searchServices" # Construct URL _url = kwargs.pop( @@ -326,8 +321,8 @@ def _create_or_update_initial( service: Union[_models.SearchService, IO[bytes]], search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> _models.SearchService: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,7 +335,7 @@ def _create_or_update_initial( 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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -365,10 +360,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -376,14 +371,14 @@ def _create_or_update_initial( 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) - if response.status_code == 200: - deserialized = self._deserialize("SearchService", pipeline_response) - - if response.status_code == 201: - deserialized = self._deserialize("SearchService", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -410,11 +405,11 @@ def begin_create_or_update( :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 globally unique since they are part of - the service URI (https://:code:``.search.windows.net). You cannot change the service name + :param search_service_name: The name of the 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 globally 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. @@ -451,11 +446,11 @@ def begin_create_or_update( :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 globally unique since they are part of - the service URI (https://:code:``.search.windows.net). You cannot change the service name + :param search_service_name: The name of the 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 globally 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. @@ -490,11 +485,11 @@ def begin_create_or_update( :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 globally unique since they are part of - the service URI (https://:code:``.search.windows.net). You cannot change the service name + :param search_service_name: The name of the 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 globally 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 @@ -530,10 +525,11 @@ def begin_create_or_update( 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) + deserialized = self._deserialize("SearchService", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -574,7 +570,7 @@ def update( :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. + :param search_service_name: The name of the 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 @@ -608,7 +604,7 @@ def update( :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. + :param search_service_name: The name of the 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] @@ -640,7 +636,7 @@ def update( :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. + :param search_service_name: The name of the 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. @@ -652,7 +648,7 @@ def update( :rtype: ~azure.mgmt.search.models.SearchService :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -690,7 +686,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -704,7 +699,7 @@ def update( 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) + deserialized = self._deserialize("SearchService", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -727,8 +722,8 @@ def get( :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. + :param search_service_name: The name of the 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: @@ -737,7 +732,7 @@ def get( :rtype: ~azure.mgmt.search.models.SearchService :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -764,7 +759,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -778,7 +772,7 @@ def get( 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) + deserialized = self._deserialize("SearchService", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -801,8 +795,8 @@ def delete( # pylint: disable=inconsistent-return-statements :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. + :param search_service_name: The name of the 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: @@ -811,7 +805,7 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -838,7 +832,6 @@ def delete( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -883,7 +876,7 @@ def list_by_resource_group( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -905,7 +898,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -921,7 +913,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -972,7 +963,7 @@ def list_by_subscription( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -993,7 +984,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -1009,7 +999,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request @@ -1046,8 +1035,8 @@ def check_name_availability( **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). + must be globally unique since they are part of the service URI (https://\\ + :code:``.search.windows.net). .. seealso:: - https://aka.ms/search-manage @@ -1063,7 +1052,7 @@ def check_name_availability( :rtype: ~azure.mgmt.search.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1094,7 +1083,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -1108,7 +1096,7 @@ def check_name_availability( 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) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # 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 index f02acbd0749c..e7d3e3be1387 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -17,13 +16,14 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +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 @@ -31,12 +31,11 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +55,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + 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") @@ -67,9 +66,7 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "sharedPrivateLinkResourceName": _SERIALIZER.url( "shared_private_link_resource_name", shared_private_link_resource_name, "str" ), @@ -103,7 +100,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -113,9 +110,7 @@ def build_get_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "sharedPrivateLinkResourceName": _SERIALIZER.url( "shared_private_link_resource_name", shared_private_link_resource_name, "str" ), @@ -147,7 +142,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,9 +152,7 @@ def build_delete_request( ) # pylint: disable=line-too-long 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), "sharedPrivateLinkResourceName": _SERIALIZER.url( "shared_private_link_resource_name", shared_private_link_resource_name, "str" ), @@ -190,7 +183,7 @@ def build_list_by_service_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -201,9 +194,7 @@ def build_list_by_service_request( 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]+)*$" - ), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -246,8 +237,8 @@ def _create_or_update_initial( shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO[bytes]], search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any - ) -> Optional[_models.SharedPrivateLinkResource]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,7 +251,7 @@ def _create_or_update_initial( 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[Optional[_models.SharedPrivateLinkResource]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -286,10 +277,10 @@ def _create_or_update_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -297,12 +288,14 @@ def _create_or_update_initial( 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 = None - if response.status_code == 200: - deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -330,11 +323,11 @@ def begin_create_or_update( :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. + :param search_service_name: The name of the 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. + by the 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. @@ -372,11 +365,11 @@ def begin_create_or_update( :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. + :param search_service_name: The name of the 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. + by the 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. @@ -412,11 +405,11 @@ def begin_create_or_update( :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. + :param search_service_name: The name of the 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. + by the 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. @@ -453,10 +446,11 @@ def begin_create_or_update( 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) + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized @@ -498,11 +492,11 @@ def get( :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. + :param search_service_name: The name of the 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. + by the 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: @@ -511,7 +505,7 @@ def get( :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -539,7 +533,6 @@ def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -553,22 +546,22 @@ def get( 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) + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore - def _delete_initial( # pylint: disable=inconsistent-return-statements + 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 - ) -> None: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -580,7 +573,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _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) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -596,10 +589,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -607,11 +600,19 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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, None, {}) # type: ignore + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete( @@ -630,11 +631,11 @@ def begin_delete( :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. + :param search_service_name: The name of the 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. + by the 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: @@ -652,7 +653,7 @@ def begin_delete( lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + 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, @@ -663,6 +664,7 @@ def begin_delete( 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 @@ -702,8 +704,8 @@ def list_by_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. + :param search_service_name: The name of the 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: @@ -719,7 +721,7 @@ def list_by_service( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -742,7 +744,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -758,7 +759,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 index 6c9d417fc4cf..49ab63344936 100644 --- 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 @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -20,20 +19,18 @@ ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +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 .._serialization import Serializer -from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +44,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +95,7 @@ def list_by_subscription( 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. + """Gets a list of all Search quota usages in the given subscription. .. seealso:: - https://aka.ms/search-manage @@ -118,7 +115,7 @@ def list_by_subscription( 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[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +137,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -156,7 +152,6 @@ def prepare_request(next_link=None): _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _request.method = "GET" return _request 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 1be49a69e3b5..f11aa08d0a8f 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -48,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/CreateOrUpdateSharedPrivateLinkResource.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 b007d3eb50dd..7b6abf5fa408 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 bce4e99cad5d..06c3ba7513a7 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 @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/DeleteSharedPrivateLinkResource.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 8cca6f78a9d5..fa2929af3c5c 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 0ddd7402f074..ff23bb5b3e09 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetQuotaUsage.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 d85b581ee7ba..4524cb89f073 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetQuotaUsagesList.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 7c5c2729580c..02395547a600 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 @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/GetSharedPrivateLinkResource.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 628c7871b604..01d6ba3f5ce4 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListPrivateEndpointConnectionsByService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 ab221679d47a..5c0e5ab16d5e 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListSharedPrivateLinkResourcesByService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 b2360b507a59..962bd46afb33 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/ListSupportedPrivateLinkResources.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 deleted file mode 100644 index 135b7244c473..000000000000 --- a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_get.py +++ /dev/null @@ -1,43 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.search import SearchManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-search -# USAGE - python network_security_perimeter_configurations_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = SearchManagementClient( - credential=DefaultAzureCredential(), - subscription_id="subid", - ) - - response = client.network_security_perimeter_configurations.get( - resource_group_name="rg1", - search_service_name="mysearchservice", - nsp_config_name="00000001-2222-3333-4444-111144444444.assoc1", - ) - print(response) - - -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/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 deleted file mode 100644 index 551a4c705935..000000000000 --- a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_list_by_service.py +++ /dev/null @@ -1,43 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.search import SearchManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-search -# USAGE - python network_security_perimeter_configurations_list_by_service.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="subid", - ) - - response = client.network_security_perimeter_configurations.list_by_service( - resource_group_name="rg1", - search_service_name="mysearchservice", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/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 deleted file mode 100644 index a6d0f7a613e2..000000000000 --- a/sdk/search/azure-mgmt-search/generated_samples/network_security_perimeter_configurations_reconcile.py +++ /dev/null @@ -1,42 +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 azure.identity import DefaultAzureCredential - -from azure.mgmt.search import SearchManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-search -# USAGE - python network_security_perimeter_configurations_reconcile.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="subid", - ) - - client.network_security_perimeter_configurations.begin_reconcile( - resource_group_name="rg1", - search_service_name="mysearchservice", - nsp_config_name="00000001-2222-3333-4444-111144444444.assoc1", - ).result() - - -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/NetworkSecurityPerimeterConfigurationsReconcile.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/operations_list.py similarity index 92% rename from sdk/search/azure-mgmt-search/generated_samples/search_list_operations.py rename to sdk/search/azure-mgmt-search/generated_samples/operations_list.py index 9eed372d1c2f..db69defb26e0 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_list_operations.py +++ b/sdk/search/azure-mgmt-search/generated_samples/operations_list.py @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-search # USAGE - python search_list_operations.py + python operations_list.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListOperations.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/OperationsList.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 c91a7ede9793..3e6dcd3dd2fb 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -45,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 21aa2daf1e6d..e9cd3529368a 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceAuthOptions.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 c849350b6805..48b713dde26a 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -45,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 2a226e0a7948..1d4f45008efb 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 06c1fb38a007..4254a0bc5468 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 deleted file mode 100644 index fded6931791e..000000000000 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_to_allow_access_from_public_custom_ips_and_bypass.py +++ /dev/null @@ -1,58 +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 typing import Any, IO, Union - -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_to_allow_access_from_public_custom_ips_and_bypass.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="subid", - ) - - response = client.services.begin_create_or_update( - resource_group_name="rg1", - search_service_name="mysearchservice", - service={ - "location": "westus", - "properties": { - "hostingMode": "default", - "networkRuleSet": { - "bypass": "AzurePortal", - "ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}], - }, - "partitionCount": 1, - "replicaCount": 1, - }, - "sku": {"name": "standard"}, - "tags": {"app-name": "My e-commerce app"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/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 4ccb92ac8bc4..7800e26551ee 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -50,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 deleted file mode 100644 index e591766a54f7..000000000000 --- a/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_with_data_exfiltration.py +++ /dev/null @@ -1,55 +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 typing import Any, IO, Union - -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_data_exfiltration.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="subid", - ) - - response = client.services.begin_create_or_update( - resource_group_name="rg1", - search_service_name="mysearchservice", - service={ - "location": "westus", - "properties": { - "disabledDataExfiltrationOptions": ["All"], - "hostingMode": "default", - "partitionCount": 1, - "replicaCount": 3, - }, - "sku": {"name": "standard"}, - "tags": {"app-name": "My e-commerce app"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/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 104a55ba6c83..2e930ee46e6d 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -36,12 +34,7 @@ def main(): 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": {} - }, - }, + "identity": {"type": "SystemAssigned"}, "location": "westus", "properties": {"hostingMode": "default", "partitionCount": 1, "replicaCount": 3}, "sku": {"name": "standard"}, @@ -51,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateServiceWithIdentity.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchCreateOrUpdateServiceWithIdentity.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 50e2e25dd481..dd6588629619 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -45,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateOrUpdateWithSemanticSearch.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 1d3be4ea9695..b4f503e47f14 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 @@ -33,11 +33,11 @@ def main(): response = client.query_keys.create( resource_group_name="rg1", search_service_name="mysearchservice", - name="An API key granting read-only access to the documents collection of an index.", + name="Query key for browser-based clients", ) print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchCreateQueryKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 bbc5dd944922..f27d1907099f 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 @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchDeleteQueryKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 d715438932b1..0ddabf94d0ee 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 @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchDeleteService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 014e2cfe0dfb..63da8802eae7 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchGetAdminKeys.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 89180b21c021..36731498dc08 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchGetService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchGetService.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 57fba1fc7bdc..302e4b4546ce 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 @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListQueryKeysBySearchService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 da32cc14e3e3..000614e47b0c 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListServicesByResourceGroup.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 6a79c4cd196e..58c756a6896c 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 @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchListServicesBySubscription.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 5a8992fa3aec..653c7733f09a 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 @@ -6,15 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models """ # PREREQUISITES pip install azure-identity @@ -43,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchRegenerateAdminKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 2fc7c08c6a92..a1cd26ec91a6 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 adeae276b8cd..8573152187ce 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -46,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceAuthOptions.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 e32679ab3015..1f58f0fa1368 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceDisableLocalAuth.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 bc1fb65456df..d8237e419f80 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 1baa5ed061d3..f4a7db3907c1 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -47,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 deleted file mode 100644 index c94e0ac92e9b..000000000000 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_to_allow_access_from_public_custom_ips_and_bypass.py +++ /dev/null @@ -1,55 +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 typing import Any, IO, Union - -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_to_allow_access_from_public_custom_ips_and_bypass.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="subid", - ) - - response = client.services.update( - resource_group_name="rg1", - search_service_name="mysearchservice", - service={ - "properties": { - "networkRuleSet": { - "bypass": "AzurePortal", - "ipRules": [{"value": "123.4.5.6"}, {"value": "123.4.6.0/18"}], - }, - "partitionCount": 1, - "publicNetworkAccess": "enabled", - "replicaCount": 3, - } - }, - ) - print(response) - - -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/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 a3abf6e9afd8..95ecc08cc307 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceToRemoveIdentity.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 6fd7ae2d2d68..77a030d91929 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithCmkEnforcement.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/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 deleted file mode 100644 index ddcd0eb78108..000000000000 --- a/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_data_exfiltration.py +++ /dev/null @@ -1,48 +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 typing import Any, IO, Union - -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_data_exfiltration.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="subid", - ) - - response = client.services.update( - resource_group_name="rg1", - search_service_name="mysearchservice", - service={ - "properties": {"disabledDataExfiltrationOptions": ["All"], "replicaCount": 2}, - "tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithDataExfiltration.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 6df99c9e1d03..60e4efd94b5d 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -43,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/SearchUpdateServiceWithSemanticSearch.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/SearchUpdateServiceWithSemanticSearch.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 2cb2f9d5406f..57c0ef8a60cb 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 @@ -6,8 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.search import SearchManagementClient @@ -38,13 +36,13 @@ 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": "Rejected for some reason", "status": "Rejected"} } }, ) print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/preview/2024-06-01-preview/examples/UpdatePrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2025-05-01/examples/UpdatePrivateEndpointConnection.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 new file mode 100644 index 000000000000..16cc48c352e7 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# 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 os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + searchmanagement_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + searchmanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + searchmanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + searchmanagement_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=searchmanagement_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=searchmanagement_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=searchmanagement_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=searchmanagement_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") 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 new file mode 100644 index 000000000000..4ed7ed23a7b9 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management.py @@ -0,0 +1,31 @@ +# 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 TestSearchManagement(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SearchManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 new file mode 100644 index 000000000000..b24cc56a7942 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 TestSearchManagementAdminKeysOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SearchManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_admin_keys_regenerate(self, resource_group): + response = self.client.admin_keys.regenerate( + 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 new file mode 100644 index 000000000000..537e68ac8eb9 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_admin_keys_operations_async.py @@ -0,0 +1,45 @@ +# 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 TestSearchManagementAdminKeysOperationsAsync(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_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_admin_keys_regenerate(self, resource_group): + response = await self.client.admin_keys.regenerate( + 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 new file mode 100644 index 000000000000..4eb76cd346b6 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_async.py @@ -0,0 +1,32 @@ +# 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 TestSearchManagementAsync(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_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_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations.py new file mode 100644 index 000000000000..0917694f8a6a --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 TestSearchManagementOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SearchManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + 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_operations_async.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations_async.py new file mode 100644 index 000000000000..1746785cafd8 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 TestSearchManagementOperationsAsync(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_operations_list(self, resource_group): + response = self.client.operations.list( + 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_endpoint_connections_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..966c2be92c47 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations.py @@ -0,0 +1,85 @@ +# 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 TestSearchManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SearchManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_update(self, resource_group): + response = self.client.private_endpoint_connections.update( + resource_group_name=resource_group.name, + search_service_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection={ + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "None", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, + "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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_delete(self, resource_group): + response = self.client.private_endpoint_connections.delete( + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 new file mode 100644 index 000000000000..c10a2cd86abd --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_endpoint_connections_operations_async.py @@ -0,0 +1,86 @@ +# 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 TestSearchManagementPrivateEndpointConnectionsOperationsAsync(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_private_endpoint_connections_update(self, resource_group): + response = await self.client.private_endpoint_connections.update( + resource_group_name=resource_group.name, + search_service_name="str", + private_endpoint_connection_name="str", + private_endpoint_connection={ + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "None", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, + "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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_delete(self, resource_group): + response = await self.client.private_endpoint_connections.delete( + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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 new file mode 100644 index 000000000000..8f0ba5742f82 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations.py @@ -0,0 +1,31 @@ +# 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 TestSearchManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SearchManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 new file mode 100644 index 000000000000..127bfee7fac2 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_private_link_resources_operations_async.py @@ -0,0 +1,32 @@ +# 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 TestSearchManagementPrivateLinkResourcesOperationsAsync(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_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 new file mode 100644 index 000000000000..fa89e0ce01ff --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations.py @@ -0,0 +1,57 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 TestSearchManagementQueryKeysOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SearchManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_keys_create(self, resource_group): + response = self.client.query_keys.create( + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_query_keys_delete(self, resource_group): + response = self.client.query_keys.delete( + 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 new file mode 100644 index 000000000000..8aab03e30b32 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_query_keys_operations_async.py @@ -0,0 +1,58 @@ +# 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 TestSearchManagementQueryKeysOperationsAsync(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_query_keys_create(self, resource_group): + response = await self.client.query_keys.create( + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_query_keys_delete(self, resource_group): + response = await self.client.query_keys.delete( + 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_services_operations.py b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations.py new file mode 100644 index 000000000000..b8aa53aaf3c6 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations.py @@ -0,0 +1,206 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 TestSearchManagementServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SearchManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_services_begin_create_or_update(self, resource_group): + response = self.client.services.begin_create_or_update( + resource_group_name=resource_group.name, + search_service_name="str", + service={ + "location": "str", + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, + "disableLocalAuth": bool, + "encryptionWithCmk": {"encryptionComplianceStatus": "str", "enforcement": "str"}, + "hostingMode": "default", + "id": "str", + "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, + "name": "str", + "networkRuleSet": {"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", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "enabled", + "replicaCount": 1, + "semanticSearch": "str", + "sharedPrivateLinkResources": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", + "status": "str", + }, + "type": "str", + } + ], + "sku": {"name": "str"}, + "status": "str", + "statusDetails": "str", + "tags": {"str": "str"}, + "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_services_update(self, resource_group): + response = self.client.services.update( + resource_group_name=resource_group.name, + search_service_name="str", + service={ + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, + "disableLocalAuth": bool, + "encryptionWithCmk": {"encryptionComplianceStatus": "str", "enforcement": "str"}, + "hostingMode": "default", + "id": "str", + "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, + "location": "str", + "name": "str", + "networkRuleSet": {"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", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "enabled", + "replicaCount": 1, + "semanticSearch": "str", + "sharedPrivateLinkResources": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", + "status": "str", + }, + "type": "str", + } + ], + "sku": {"name": "str"}, + "status": "str", + "statusDetails": "str", + "tags": {"str": "str"}, + "type": "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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 + # ... + + @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", + ) + 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 + # ... 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 new file mode 100644 index 000000000000..f9ff40d2295c --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_services_operations_async.py @@ -0,0 +1,209 @@ +# 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 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_begin_create_or_update(self, resource_group): + response = await ( + await self.client.services.begin_create_or_update( + resource_group_name=resource_group.name, + search_service_name="str", + service={ + "location": "str", + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "str"}, "apiKeyOnly": {}}, + "disableLocalAuth": bool, + "encryptionWithCmk": {"encryptionComplianceStatus": "str", "enforcement": "str"}, + "hostingMode": "default", + "id": "str", + "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, + "name": "str", + "networkRuleSet": {"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", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "enabled", + "replicaCount": 1, + "semanticSearch": "str", + "sharedPrivateLinkResources": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", + "status": "str", + }, + "type": "str", + } + ], + "sku": {"name": "str"}, + "status": "str", + "statusDetails": "str", + "tags": {"str": "str"}, + "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_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": {}}, + "disableLocalAuth": bool, + "encryptionWithCmk": {"encryptionComplianceStatus": "str", "enforcement": "str"}, + "hostingMode": "default", + "id": "str", + "identity": {"type": "str", "principalId": "str", "tenantId": "str"}, + "location": "str", + "name": "str", + "networkRuleSet": {"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", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "enabled", + "replicaCount": 1, + "semanticSearch": "str", + "sharedPrivateLinkResources": [ + { + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", + "status": "str", + }, + "type": "str", + } + ], + "sku": {"name": "str"}, + "status": "str", + "statusDetails": "str", + "tags": {"str": "str"}, + "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_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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + 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 + # ... + + @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", + ) + 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 + # ... 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 new file mode 100644 index 000000000000..8bdd61f3f762 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.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 TestSearchManagementSharedPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): + 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_begin_create_or_update(self, resource_group): + response = self.client.shared_private_link_resources.begin_create_or_update( + resource_group_name=resource_group.name, + search_service_name="str", + shared_private_link_resource_name="str", + shared_private_link_resource={ + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", + "status": "str", + }, + "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): + response = self.client.shared_private_link_resources.begin_delete( + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 new file mode 100644 index 000000000000..c7d9f396f2c4 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_shared_private_link_resources_operations_async.py @@ -0,0 +1,88 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.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 TestSearchManagementSharedPrivateLinkResourcesOperationsAsync(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_shared_private_link_resources_begin_create_or_update(self, resource_group): + response = await ( + await self.client.shared_private_link_resources.begin_create_or_update( + resource_group_name=resource_group.name, + search_service_name="str", + shared_private_link_resource_name="str", + shared_private_link_resource={ + "id": "str", + "name": "str", + "properties": { + "groupId": "str", + "privateLinkResourceId": "str", + "provisioningState": "str", + "requestMessage": "str", + "resourceRegion": "str", + "status": "str", + }, + "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): + response = await ( + await self.client.shared_private_link_resources.begin_delete( + 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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async 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 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 new file mode 100644 index 000000000000..98cc7343b1be --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 TestSearchManagementUsagesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SearchManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + 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 new file mode 100644 index 000000000000..c03f90fade77 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_tests/test_search_management_usages_operations_async.py @@ -0,0 +1,31 @@ +# 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 TestSearchManagementUsagesOperationsAsync(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_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/setup.py b/sdk/search/azure-mgmt-search/setup.py index 3dd1d3586584..9d3d278b3aab 100644 --- a/sdk/search/azure-mgmt-search/setup.py +++ b/sdk/search/azure-mgmt-search/setup.py @@ -75,6 +75,7 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", "azure-mgmt-core>=1.3.2", ],