From ad406367b2d0abf877a4f244da97a8062623b848 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 18 Oct 2023 22:53:26 +0000 Subject: [PATCH] CodeGen from PR 26295 in Azure/azure-rest-api-specs Merge dde2cbde5813c0fad6902629d779bf126c10ff9c into 4c38cb9966cd6afbb03c7e9b14997720a728baee --- sdk/search/azure-mgmt-search/_meta.json | 10 +- .../azure/mgmt/search/_configuration.py | 13 +- .../mgmt/search/_search_management_client.py | 20 +- .../azure/mgmt/search/_serialization.py | 32 +- .../azure/mgmt/search/_vendor.py | 28 +- .../azure/mgmt/search/_version.py | 2 +- .../azure/mgmt/search/aio/_configuration.py | 13 +- .../search/aio/_search_management_client.py | 20 +- .../azure/mgmt/search/aio/_vendor.py | 28 ++ .../mgmt/search/aio/operations/__init__.py | 4 + .../aio/operations/_admin_keys_operations.py | 36 +- .../mgmt/search/aio/operations/_operations.py | 13 +- ...private_endpoint_connections_operations.py | 91 ++-- .../_private_link_resources_operations.py | 20 +- .../aio/operations/_query_keys_operations.py | 50 +-- .../_search_management_client_operations.py | 112 +++++ .../aio/operations/_services_operations.py | 150 ++++--- ...hared_private_link_resources_operations.py | 99 ++--- .../aio/operations/_usages_operations.py | 154 +++++++ .../azure/mgmt/search/models/__init__.py | 8 + .../azure/mgmt/search/models/_models_py3.py | 391 ++++++++++++------ .../models/_search_management_client_enums.py | 68 +-- .../azure/mgmt/search/operations/__init__.py | 4 + .../operations/_admin_keys_operations.py | 45 +- .../mgmt/search/operations/_operations.py | 16 +- ...private_endpoint_connections_operations.py | 108 ++--- .../_private_link_resources_operations.py | 25 +- .../operations/_query_keys_operations.py | 63 +-- .../_search_management_client_operations.py | 147 +++++++ .../search/operations/_services_operations.py | 179 ++++---- ...hared_private_link_resources_operations.py | 116 +++--- .../search/operations/_usages_operations.py | 187 +++++++++ ..._or_update_shared_private_link_resource.py | 2 +- .../delete_private_endpoint_connection.py | 2 +- .../delete_shared_private_link_resource.py | 5 +- .../get_private_endpoint_connection.py | 2 +- .../generated_samples/get_quota_usage.py | 41 ++ .../get_quota_usages_list.py | 41 ++ .../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 +- .../generated_samples/operations_list.py | 2 +- .../search_create_or_update_service.py | 2 +- ...h_create_or_update_service_auth_options.py | 2 +- ...te_or_update_service_disable_local_auth.py | 2 +- ..._to_allow_access_from_private_endpoints.py | 2 +- ..._to_allow_access_from_public_custom_ips.py | 2 +- ..._or_update_service_with_cmk_enforcement.py | 2 +- ..._create_or_update_service_with_identity.py | 2 +- ...h_create_or_update_with_semantic_search.py | 47 +++ .../search_create_query_key.py | 2 +- .../search_delete_query_key.py | 5 +- .../search_delete_service.py | 5 +- .../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 | 2 +- .../search_update_service.py | 2 +- .../search_update_service_auth_options.py | 2 +- ...earch_update_service_disable_local_auth.py | 2 +- ..._to_allow_access_from_private_endpoints.py | 2 +- ..._to_allow_access_from_public_custom_ips.py | 2 +- ...earch_update_service_to_remove_identity.py | 2 +- ...rch_update_service_with_cmk_enforcement.py | 2 +- ...rch_update_service_with_semantic_search.py | 45 ++ .../update_private_endpoint_connection.py | 2 +- 69 files changed, 1775 insertions(+), 726 deletions(-) create mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_vendor.py create mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_search_management_client_operations.py create mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_usages_operations.py create mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_search_management_client_operations.py create mode 100644 sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_usages_operations.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/get_quota_usage.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/get_quota_usages_list.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_semantic_search.py create mode 100644 sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_semantic_search.py diff --git a/sdk/search/azure-mgmt-search/_meta.json b/sdk/search/azure-mgmt-search/_meta.json index fd859248c293..17dff96c359a 100644 --- a/sdk/search/azure-mgmt-search/_meta.json +++ b/sdk/search/azure-mgmt-search/_meta.json @@ -1,11 +1,11 @@ { - "commit": "33a7dbc1743fdacb8e2259011a035154a98cad66", + "commit": "cc000ce3d42b87b466929bba7fd6057b06953ab4", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.9.7", "use": [ - "@autorest/python@6.2.16", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.7.1", + "@autorest/modelerfour@4.26.2" ], - "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.2.16 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/search/resource-manager/readme.md --generate-sample=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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --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/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py index 24b8b8361c5c..b05f13d7e3f0 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -34,16 +28,17 @@ class SearchManagementClientConfiguration(Configuration): # pylint: disable=too :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 "2022-09-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-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: super(SearchManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", "2022-09-01") + api_version: str = kwargs.pop("api_version", "2023-11-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 eb9cd7e82f9e..f307e3fe618c 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 @@ -21,8 +21,10 @@ PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueryKeysOperations, + SearchManagementClientOperationsMixin, ServicesOperations, SharedPrivateLinkResourcesOperations, + UsagesOperations, ) if TYPE_CHECKING: @@ -30,8 +32,10 @@ from azure.core.credentials import TokenCredential -class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Client that can be used to manage Azure Cognitive Search services and API keys. +class SearchManagementClient( + SearchManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,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 @@ -49,14 +53,17 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations :vartype shared_private_link_resources: azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.search.operations.UsagesOperations :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 "2022-09-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-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 @@ -73,7 +80,7 @@ def __init__( self._config = SearchManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -92,6 +99,7 @@ def __init__( self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -122,5 +130,5 @@ def __enter__(self) -> "SearchManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) 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 f17c068e833e..4bae2292227b 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py @@ -629,7 +629,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): @@ -662,8 +662,9 @@ def _serialize(self, target_obj, data_type=None, **kwargs): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) @@ -741,6 +742,8 @@ def query(self, name, data, data_type, **kwargs): :param 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 :raises: TypeError if serialization fails. :raises: ValueError if data is None @@ -749,10 +752,8 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -891,6 +892,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): 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 """ if isinstance(data, str): @@ -903,9 +906,14 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +958,9 @@ def serialize_dict(self, attr, dict_type, **kwargs): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -1271,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1295,7 +1305,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): 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 bd0df84f5319..7c69bc1c15b5 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_vendor.py @@ -5,10 +5,19 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import List, cast +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 @@ -18,13 +27,10 @@ def _convert_request(request, files=None): return request -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) +class SearchManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "PipelineClient" + _config: SearchManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" 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 b77ac9246082..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.0.0" +VERSION = "1.0.0b1" 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 b5ae1b276b46..2c6b03d5735f 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 @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -34,16 +28,17 @@ class SearchManagementClientConfiguration(Configuration): # pylint: disable=too :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 "2022-09-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-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: super(SearchManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", "2022-09-01") + api_version: str = kwargs.pop("api_version", "2023-11-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 5f316590f2a2..add5d66b00b4 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 @@ -21,8 +21,10 @@ PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, QueryKeysOperations, + SearchManagementClientOperationsMixin, ServicesOperations, SharedPrivateLinkResourcesOperations, + UsagesOperations, ) if TYPE_CHECKING: @@ -30,8 +32,10 @@ from azure.core.credentials_async import AsyncTokenCredential -class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """Client that can be used to manage Azure Cognitive Search services and API keys. +class SearchManagementClient( + SearchManagementClientOperationsMixin +): # pylint: disable=client-accepts-api-version-keyword,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 @@ -50,14 +54,17 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations :vartype shared_private_link_resources: azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations + :ivar usages: UsagesOperations operations + :vartype usages: azure.mgmt.search.aio.operations.UsagesOperations :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 "2022-09-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-11-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 @@ -74,7 +81,7 @@ def __init__( self._config = SearchManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -93,6 +100,7 @@ def __init__( self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) + self.usages = UsagesOperations(self._client, self._config, self._serialize, self._deserialize) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -123,5 +131,5 @@ async def __aenter__(self) -> "SearchManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) 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 new file mode 100644 index 000000000000..f66a40025d67 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_vendor.py @@ -0,0 +1,28 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from abc import ABC +from typing import TYPE_CHECKING + +from 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 + + +class SearchManagementClientMixinABC(ABC): + """DO NOT use this class. It is for internal typing use only.""" + + _client: "AsyncPipelineClient" + _config: SearchManagementClientConfiguration + _serialize: "Serializer" + _deserialize: "Deserializer" 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 b7967f39c207..b96a319c2e09 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 @@ -13,6 +13,8 @@ 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 ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -26,6 +28,8 @@ "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", "SharedPrivateLinkResourcesOperations", + "UsagesOperations", + "SearchManagementClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) _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 17bd173e0489..521421e38616 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -27,11 +26,8 @@ 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, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -63,13 +59,16 @@ 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 Cognitive Search service. + """Gets the primary and secondary admin API keys for the specified search service. + + .. seealso:: + - https://aka.ms/search-manage :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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,9 +89,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None @@ -112,8 +109,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,11 +143,14 @@ async def regenerate( """Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. @@ -173,9 +174,7 @@ async def regenerate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None @@ -196,8 +195,9 @@ async def regenerate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 59426db1af96..0f732497db2f 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -29,11 +28,8 @@ 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, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,9 +65,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -122,8 +116,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 56690086adeb..5b7441aaef0a 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -35,11 +35,8 @@ build_list_by_service_request, build_update_request, ) +from .._vendor import SearchManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -77,14 +74,17 @@ async def update( ) -> _models.PrivateEndpointConnection: """Updates a Private Endpoint connection to the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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. @@ -115,14 +115,17 @@ async def update( ) -> _models.PrivateEndpointConnection: """Updates a Private Endpoint connection to the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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. @@ -151,17 +154,20 @@ async def update( ) -> _models.PrivateEndpointConnection: """Updates a Private Endpoint connection to the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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 model type or a IO type. Required. + update. Is either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -185,9 +191,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -197,7 +201,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(private_endpoint_connection, (IO, bytes)): + if isinstance(private_endpoint_connection, (IOBase, bytes)): _content = private_endpoint_connection else: _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") @@ -219,8 +223,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -252,14 +257,17 @@ async def get( """Gets the details of the private endpoint connection to the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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: @@ -280,9 +288,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None @@ -303,8 +309,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,14 +342,17 @@ async def delete( ) -> Optional[_models.PrivateEndpointConnection]: """Disconnects the private endpoint connection and deletes it from the search service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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: @@ -363,9 +373,7 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) _client_request_id = None @@ -386,8 +394,9 @@ async def delete( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,11 +428,14 @@ def list_by_service( ) -> AsyncIterable["_models.PrivateEndpointConnection"]: """Gets a list of all private endpoint connections in the given service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -438,9 +450,7 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -498,8 +508,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 34b0497a4323..6da6ea3d4286 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -29,11 +28,8 @@ 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, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,11 +63,14 @@ def list_supported( ) -> AsyncIterable["_models.PrivateLinkResource"]: """Gets a list of all supported private link resource types for the given service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -84,9 +83,7 @@ def list_supported( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -144,8 +141,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 1c6a76a45b83..fced8440754a 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -34,11 +33,8 @@ build_delete_request, build_list_by_search_service_request, ) +from .._vendor import SearchManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,11 +70,14 @@ async def create( """Generates a new query key for the specified search service. You can create up to 50 query keys per service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 @@ -101,9 +100,7 @@ async def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.QueryKey] = kwargs.pop("cls", None) _client_request_id = None @@ -124,8 +121,9 @@ async def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,13 +151,16 @@ 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 Cognitive Search service. + """Returns the list of query API keys for the given search service. + + .. seealso:: + - https://aka.ms/search-manage :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -172,9 +173,7 @@ def list_by_search_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -232,8 +231,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -261,11 +261,14 @@ async def delete( # pylint: disable=inconsistent-return-statements """Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. @@ -289,9 +292,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None @@ -312,8 +313,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 new file mode 100644 index 000000000000..e6040a75cb00 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_search_management_client_operations.py @@ -0,0 +1,112 @@ +# 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. +# 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, Callable, Dict, Optional, TypeVar + +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.rest import 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 + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SearchManagementClientOperationsMixin(SearchManagementClientMixinABC): + @distributed_trace_async + async def usage_by_subscription_sku( + self, + location: str, + sku_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> _models.QuotaUsageResult: + """Gets the quota usage for a search SKU in the given subscription. + + .. seealso:: + - https://aka.ms/search-manage + + :param location: The unique location name for a Microsoft Azure geographic region. Required. + :type location: str + :param sku_name: The unique SKU name that identifies a billable tier. Required. + :type sku_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuotaUsageResult or the result of cls(response) + :rtype: ~azure.mgmt.search.models.QuotaUsageResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.QuotaUsageResult] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_usage_by_subscription_sku_request( + location=location, + sku_name=sku_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.usage_by_subscription_sku.metadata["url"], + 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( # type: ignore # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("QuotaUsageResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + usage_by_subscription_sku.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}" + } 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 da2d6969fc55..50553865aa05 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -40,6 +41,7 @@ build_list_by_subscription_request, build_update_request, ) +from .._vendor import SearchManagementClientMixinABC if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -87,9 +89,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -99,7 +99,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(service, (IO, bytes)): + if isinstance(service, (IOBase, bytes)): _content = service else: _json = self._serialize.body(service, "SearchService") @@ -120,8 +120,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -159,15 +160,18 @@ async def begin_create_or_update( """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. + :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. :type service: ~azure.mgmt.search.models.SearchService @@ -205,15 +209,18 @@ async def begin_create_or_update( """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. + :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. :type service: IO @@ -249,18 +256,21 @@ async def begin_create_or_update( """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. + :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 model - type or a IO type. Required. + :param service: The definition of the search service to create or update. Is either a + SearchService type or a IO type. Required. :type service: ~azure.mgmt.search.models.SearchService or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -284,9 +294,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -345,10 +353,13 @@ async def update( ) -> _models.SearchService: """Updates an existing search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 @@ -377,10 +388,13 @@ async def update( ) -> _models.SearchService: """Updates an existing search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 @@ -407,13 +421,16 @@ async def update( ) -> _models.SearchService: """Updates an existing search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 model type or a IO - type. Required. + :param service: The definition of the search service to update. Is either a SearchServiceUpdate + type or a IO type. Required. :type service: ~azure.mgmt.search.models.SearchServiceUpdate or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -437,9 +454,7 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -449,7 +464,7 @@ async def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(service, (IO, bytes)): + if isinstance(service, (IOBase, bytes)): _content = service else: _json = self._serialize.body(service, "SearchServiceUpdate") @@ -470,8 +485,9 @@ async def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -501,11 +517,14 @@ async def get( ) -> _models.SearchService: """Gets the search service with the given name in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -526,9 +545,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None @@ -548,8 +565,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -579,11 +597,14 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a search service in the given resource group, along with its associated resources. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -604,9 +625,7 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None @@ -626,8 +645,9 @@ async def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -652,6 +672,9 @@ def list_by_resource_group( ) -> AsyncIterable["_models.SearchService"]: """Gets a list of all Search services in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str @@ -666,9 +689,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -725,8 +746,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -748,6 +770,9 @@ def list_by_subscription( ) -> AsyncIterable["_models.SearchService"]: """Gets a list of all Search services in the given subscription. + .. seealso:: + - https://aka.ms/search-manage + :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -759,9 +784,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -817,8 +840,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -843,6 +867,9 @@ async def check_name_availability( must be globally unique since they are part of the service URI (https://:code:``.search.windows.net). + .. seealso:: + - https://aka.ms/search-manage + :param name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. @@ -870,9 +897,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) type: Literal["searchServices"] = kwargs.pop("type", "searchServices") cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) @@ -896,8 +921,9 @@ async def check_name_availability( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 e5fc3dc81da5..6494d08e42be 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -37,11 +37,8 @@ build_get_request, build_list_by_service_request, ) +from .._vendor import SearchManagementClientMixinABC -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,9 +82,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -97,7 +92,7 @@ async def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(shared_private_link_resource, (IO, bytes)): + if isinstance(shared_private_link_resource, (IOBase, bytes)): _content = shared_private_link_resource else: _json = self._serialize.body(shared_private_link_resource, "SharedPrivateLinkResource") @@ -119,8 +114,9 @@ async def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -157,14 +153,17 @@ async def begin_create_or_update( """Initiates the creation or update of a shared private link resource managed by the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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. @@ -204,14 +203,17 @@ async def begin_create_or_update( """Initiates the creation or update of a shared private link resource managed by the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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. @@ -249,17 +251,20 @@ async def begin_create_or_update( """Initiates the creation or update of a shared private link resource managed by the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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 model type or a IO type. Required. + create or update. Is either a SharedPrivateLinkResource type or a IO type. Required. :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -283,9 +288,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -347,14 +350,17 @@ async def get( """Gets the details of the shared private link resource managed by the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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: @@ -375,9 +381,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) _client_request_id = None @@ -398,8 +402,9 @@ async def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -438,9 +443,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None @@ -461,8 +464,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -489,14 +493,17 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Initiates the deletion of the shared private link resource from the search service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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: @@ -516,9 +523,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -573,11 +578,14 @@ def list_by_service( ) -> AsyncIterable["_models.SharedPrivateLinkResource"]: """Gets a list of all shared private link resources managed by the given service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -592,9 +600,7 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -652,8 +658,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 new file mode 100644 index 000000000000..aef200530ea9 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_usages_operations.py @@ -0,0 +1,154 @@ +# 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. +# 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, AsyncIterable, Callable, Dict, Optional, TypeVar +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.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 ... import models as _models +from ..._vendor import _convert_request +from ...operations._usages_operations import build_list_by_subscription_request +from .._vendor import SearchManagementClientMixinABC + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`usages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = 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_subscription( + self, + location: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> AsyncIterable["_models.QuotaUsageResult"]: + """Gets a list of all Search quota usages in the given subscription. + + .. seealso:: + - https://aka.ms/search-manage + + :param location: The unique location name for a Microsoft Azure geographic region. Required. + :type location: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QuotaUsageResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.QuotaUsageResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_list_by_subscription_request( + location=location, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + 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("QuotaUsagesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages" + } 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 8feb69069db5..414aae883dd0 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 @@ -30,6 +30,9 @@ from ._models_py3 import PrivateLinkResourceProperties from ._models_py3 import PrivateLinkResourcesResult 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 @@ -53,6 +56,7 @@ from ._search_management_client_enums import PublicNetworkAccess 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 @@ -88,6 +92,9 @@ "PrivateLinkResourceProperties", "PrivateLinkResourcesResult", "QueryKey", + "QuotaUsageResult", + "QuotaUsageResultName", + "QuotaUsagesListResult", "Resource", "SearchManagementRequestOptions", "SearchService", @@ -110,6 +117,7 @@ "PublicNetworkAccess", "SearchEncryptionComplianceStatus", "SearchEncryptionWithCmk", + "SearchSemanticSearch", "SearchServiceStatus", "SharedPrivateLinkResourceAsyncOperationResult", "SharedPrivateLinkResourceProvisioningState", 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 7e1f8f58f53d..e1c746427d00 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 @@ -24,8 +24,7 @@ class AdminKeyResult(_serialization.Model): - """Response containing the primary and secondary admin API keys for a given Azure Cognitive 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. @@ -208,10 +207,10 @@ def __init__( class DataPlaneAadOrApiKeyAuthOption(_serialization.Model): - """Indicates that either the API key or an access token from Azure Active Directory can be used - for authentication. + """Indicates that either the API key or an access token from a Microsoft Entra ID tenant can be + used for authentication. - :ivar aad_auth_failure_mode: Describes what response the data plane API of a Search service + :ivar aad_auth_failure_mode: Describes what response the data plane API of a search service would send for requests that failed authentication. Known values are: "http403" and "http401WithBearerChallenge". :vartype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode @@ -225,7 +224,7 @@ def __init__( self, *, aad_auth_failure_mode: Optional[Union[str, "_models.AadAuthFailureMode"]] = None, **kwargs: Any ) -> None: """ - :keyword aad_auth_failure_mode: Describes what response the data plane API of a Search service + :keyword aad_auth_failure_mode: Describes what response the data plane API of a search service would send for requests that failed authentication. Known values are: "http403" and "http401WithBearerChallenge". :paramtype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode @@ -235,13 +234,13 @@ def __init__( class DataPlaneAuthOptions(_serialization.Model): - """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. + """Defines the options for how the search service authenticates a data plane request. This cannot + be set if 'disableLocalAuth' is set to true. - :ivar api_key_only: Indicates that only the API key needs to be used for authentication. + :ivar api_key_only: Indicates that only the API key can be used for authentication. :vartype api_key_only: JSON - :ivar aad_or_api_key: Indicates that either the API key or an access token from Azure Active - Directory can be used for authentication. + :ivar aad_or_api_key: Indicates that either the API key or an access token from a Microsoft + Entra ID tenant can be used for authentication. :vartype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption """ @@ -258,10 +257,10 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword api_key_only: Indicates that only the API key needs to be used for authentication. + :keyword api_key_only: Indicates that only the API key can be used for authentication. :paramtype api_key_only: JSON - :keyword aad_or_api_key: Indicates that either the API key or an access token from Azure Active - Directory can be used for authentication. + :keyword aad_or_api_key: Indicates that either the API key or an access token from a Microsoft + Entra ID tenant can be used for authentication. :paramtype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption """ super().__init__(**kwargs) @@ -271,17 +270,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 having one or more non - customer encrypted resources. 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: 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". + 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 """ @@ -299,8 +298,8 @@ def __init__( self, *, enforcement: Optional[Union[str, "_models.SearchEncryptionWithCmk"]] = None, **kwargs: Any ) -> None: """ - :keyword enforcement: Describes how a search service should enforce having one or more non - customer encrypted resources. 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) @@ -347,10 +346,10 @@ def __init__(self, *, type: Union[str, "_models.IdentityType"], **kwargs: Any) - class IpRule(_serialization.Model): - """The IP restriction rule of the Azure Cognitive 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 """ @@ -360,8 +359,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) @@ -369,11 +368,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 Cognitive 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 Cognitive 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. @@ -398,14 +397,11 @@ def __init__(self, **kwargs: Any) -> None: class NetworkRuleSet(_serialization.Model): - """Network specific rules that determine how the Azure Cognitive 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] """ @@ -415,12 +411,9 @@ class NetworkRuleSet(_serialization.Model): 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] """ super().__init__(**kwargs) @@ -496,7 +489,7 @@ def __init__(self, **kwargs: Any) -> None: class OperationListResult(_serialization.Model): """The result of the request to list REST API operations. It contains a list of operations and a - URL to get the next set of results. + URL to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -559,7 +552,7 @@ def __init__(self, **kwargs: Any) -> None: class PrivateEndpointConnection(Resource): - """Describes an existing Private Endpoint connection to the Azure Cognitive 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. @@ -571,8 +564,8 @@ class PrivateEndpointConnection(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 an existing Private Endpoint connection to the - Azure Cognitive Search service. + :ivar properties: Describes the properties of an existing private endpoint connection to the + search service. :vartype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties """ @@ -593,8 +586,8 @@ def __init__( self, *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, **kwargs: Any ) -> None: """ - :keyword properties: Describes the properties of an existing Private Endpoint connection to the - Azure Cognitive Search service. + :keyword properties: Describes the properties of an existing private endpoint connection to the + search service. :paramtype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties """ super().__init__(**kwargs) @@ -632,8 +625,7 @@ def __init__(self, **kwargs: Any) -> None: class PrivateEndpointConnectionProperties(_serialization.Model): - """Describes the properties of an existing Private Endpoint connection to the Azure Cognitive - 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: @@ -645,9 +637,9 @@ class PrivateEndpointConnectionProperties(_serialization.Model): :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. Can be - Updating, Deleting, Failed, Succeeded, or Incomplete. Known values are: "Updating", "Deleting", - "Failed", "Succeeded", "Incomplete", and "Canceled". + :ivar provisioning_state: The provisioning state of the private link service connection. Valid + 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 """ @@ -684,9 +676,9 @@ def __init__( :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. Can - be Updating, Deleting, Failed, Succeeded, or Incomplete. Known values are: "Updating", - "Deleting", "Failed", "Succeeded", "Incomplete", and "Canceled". + :keyword provisioning_state: The provisioning state of the private link service connection. + 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 """ @@ -721,8 +713,8 @@ class PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState(_seri """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. Can be Pending, Approved, - Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and + :ivar status: Status of the the private link service connection. Valid values are Pending, + Approved, Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". :vartype status: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionStatus :ivar description: The description for the private link service connection state. @@ -746,8 +738,8 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword status: Status of the the private link service connection. Can be Pending, Approved, - Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and + :keyword status: Status of the the private link service connection. Valid values are Pending, + Approved, Rejected, or Disconnected. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". :paramtype status: str or ~azure.mgmt.search.models.PrivateLinkServiceConnectionStatus :keyword description: The description for the private link service connection state. @@ -762,7 +754,7 @@ def __init__( class PrivateLinkResource(Resource): - """Describes a supported private link resource for the Azure Cognitive 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. @@ -774,8 +766,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 - Cognitive Search service. + :ivar properties: Describes the properties of a supported private link resource for the search + service. :vartype properties: ~azure.mgmt.search.models.PrivateLinkResourceProperties """ @@ -800,9 +792,9 @@ def __init__(self, **kwargs: Any) -> None: class PrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of a supported private link resource for the Azure Cognitive 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. @@ -813,7 +805,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 Cognitive Search. + private link service and that are supported by search. :vartype shareable_private_link_resource_types: list[~azure.mgmt.search.models.ShareablePrivateLinkResourceType] """ @@ -868,8 +860,7 @@ def __init__(self, **kwargs: Any) -> None: class QueryKey(_serialization.Model): - """Describes an API key for a given Azure Cognitive Search service that has permissions for query - operations only. + """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. @@ -896,6 +887,117 @@ def __init__(self, **kwargs: Any) -> None: self.key = None +class QuotaUsageResult(_serialization.Model): + """Describes the quota usage for a particular SKU. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. + :vartype id: str + :ivar unit: The unit of measurement for the search SKU. + :vartype unit: str + :ivar current_value: The currently used up value for the particular search SKU. + :vartype current_value: int + :ivar limit: The quota limit for the particular search SKU. + :vartype limit: int + :ivar name: The name of the SKU supported by Azure AI Search. + :vartype name: ~azure.mgmt.search.models.QuotaUsageResultName + """ + + _validation = { + "name": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "unit": {"key": "unit", "type": "str"}, + "current_value": {"key": "currentValue", "type": "int"}, + "limit": {"key": "limit", "type": "int"}, + "name": {"key": "name", "type": "QuotaUsageResultName"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + unit: Optional[str] = None, + current_value: Optional[int] = None, + limit: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The resource ID of the quota usage SKU endpoint for Microsoft.Search provider. + :paramtype id: str + :keyword unit: The unit of measurement for the search SKU. + :paramtype unit: str + :keyword current_value: The currently used up value for the particular search SKU. + :paramtype current_value: int + :keyword limit: The quota limit for the particular search SKU. + :paramtype limit: int + """ + super().__init__(**kwargs) + self.id = id + self.unit = unit + self.current_value = current_value + self.limit = limit + self.name = None + + +class QuotaUsageResultName(_serialization.Model): + """The name of the SKU supported by Azure AI Search. + + :ivar value: The SKU name supported by Azure AI Search. + :vartype value: str + :ivar localized_value: The localized string value for the SKU name. + :vartype localized_value: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "str"}, + "localized_value": {"key": "localizedValue", "type": "str"}, + } + + def __init__(self, *, value: Optional[str] = None, localized_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword value: The SKU name supported by Azure AI Search. + :paramtype value: str + :keyword localized_value: The localized string value for the SKU name. + :paramtype localized_value: str + """ + super().__init__(**kwargs) + self.value = value + self.localized_value = localized_value + + +class QuotaUsagesListResult(_serialization.Model): + """Response containing the quota usage information for all the supported SKUs of Azure AI Search. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The quota usages for the SKUs supported by Azure AI Search. + :vartype value: list[~azure.mgmt.search.models.QuotaUsageResult] + :ivar next_link: Request URL that can be used to query next page of quota usages. Returned when + the total number of requested quota usages exceed maximum page size. + :vartype next_link: str + """ + + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[QuotaUsageResult]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.value = None + self.next_link = None + + class SearchManagementRequestOptions(_serialization.Model): """Parameter group. @@ -968,7 +1070,7 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw class SearchService(TrackedResource): # pylint: disable=too-many-instance-attributes - """Describes an Azure Cognitive Search service and its current state. + """Describes a search service and its current state. Variables are only populated by the server, and will be ignored when sending a request. @@ -986,8 +1088,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 @@ -1016,10 +1118,10 @@ 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. If your service is in the degraded, disabled, or error states, it means the Azure - Cognitive Search team is actively investigating the underlying issue. Dedicated services in - these states are still chargeable based on the number of search units provisioned. Known values - are: "running", "provisioning", "deleting", "degraded", "disabled", "error", and "stopped". + 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", 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 @@ -1033,8 +1135,8 @@ class SearchService(TrackedResource): # pylint: disable=too-many-instance-attri 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 Cognitive 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 encryption_with_cmk: Specifies any policy regarding encryption of resources (such as indexes) using customer manager keys within a search service. @@ -1046,12 +1148,16 @@ 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 private_endpoint_connections: The list of private endpoint connections to the Azure - Cognitive 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 Cognitive Search service. + search service. :vartype shared_private_link_resources: list[~azure.mgmt.search.models.SharedPrivateLinkResource] """ @@ -1093,6 +1199,7 @@ class SearchService(TrackedResource): # pylint: disable=too-many-instance-attri "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, + "semantic_search": {"key": "properties.semanticSearch", "type": "str"}, "shared_private_link_resources": { "key": "properties.sharedPrivateLinkResources", "type": "[SharedPrivateLinkResource]", @@ -1114,6 +1221,7 @@ def __init__( encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, disable_local_auth: Optional[bool] = None, auth_options: Optional["_models.DataPlaneAuthOptions"] = None, + semantic_search: Optional[Union[str, "_models.SearchSemanticSearch"]] = None, **kwargs: Any ) -> None: """ @@ -1121,8 +1229,8 @@ 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. - This property is required when creating a new Search Service. + :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. :paramtype identity: ~azure.mgmt.search.models.Identity @@ -1146,8 +1254,8 @@ 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 Cognitive 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 encryption_with_cmk: Specifies any policy regarding encryption of resources (such as indexes) using customer manager keys within a search service. @@ -1159,6 +1267,10 @@ def __init__( :keyword auth_options: Defines the options for how the data plane API of a search service authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. :paramtype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions + :keyword semantic_search: Sets options that control the availability of semantic search. This + configuration is only possible for certain 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) self.sku = sku @@ -1175,15 +1287,16 @@ def __init__( self.disable_local_auth = disable_local_auth self.auth_options = auth_options self.private_endpoint_connections = None + self.semantic_search = semantic_search self.shared_private_link_resources = None class SearchServiceListResult(_serialization.Model): - """Response containing a list of Azure Cognitive Search services. + """Response containing a list of search services. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of Search services. + :ivar value: The list of search services. :vartype value: list[~azure.mgmt.search.models.SearchService] :ivar next_link: Request URL that can be used to query next page of search services. Returned when the total number of requested search services exceed maximum page size. @@ -1208,7 +1321,7 @@ def __init__(self, **kwargs: Any) -> None: class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attributes - """The parameters used to update an Azure Cognitive Search service. + """The parameters used to update a search service. Variables are only populated by the server, and will be ignored when sending a request. @@ -1220,11 +1333,11 @@ 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). + registered Azure geo regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource. :vartype location: str :ivar tags: Tags to help categorize the resource in the Azure portal. @@ -1256,10 +1369,10 @@ 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. If your service is in the degraded, disabled, or error states, it means the Azure - Cognitive Search team is actively investigating the underlying issue. Dedicated services in - these states are still chargeable based on the number of search units provisioned. Known values - are: "running", "provisioning", "deleting", "degraded", "disabled", "error", and "stopped". + 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", 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 @@ -1273,8 +1386,8 @@ class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attrib 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 Cognitive 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 encryption_with_cmk: Specifies any policy regarding encryption of resources (such as indexes) using customer manager keys within a search service. @@ -1286,12 +1399,16 @@ 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 private_endpoint_connections: The list of private endpoint connections to the Azure - Cognitive 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 Cognitive Search service. + search service. :vartype shared_private_link_resources: list[~azure.mgmt.search.models.SharedPrivateLinkResource] """ @@ -1332,6 +1449,7 @@ class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attrib "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, + "semantic_search": {"key": "properties.semanticSearch", "type": "str"}, "shared_private_link_resources": { "key": "properties.sharedPrivateLinkResources", "type": "[SharedPrivateLinkResource]", @@ -1353,14 +1471,15 @@ def __init__( encryption_with_cmk: Optional["_models.EncryptionWithCmk"] = None, disable_local_auth: Optional[bool] = None, auth_options: Optional["_models.DataPlaneAuthOptions"] = None, + semantic_search: Optional[Union[str, "_models.SearchSemanticSearch"]] = None, **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). + and registered Azure geo regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource. :paramtype location: str :keyword tags: Tags to help categorize the resource in the Azure portal. @@ -1387,8 +1506,8 @@ 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 Cognitive 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 encryption_with_cmk: Specifies any policy regarding encryption of resources (such as indexes) using customer manager keys within a search service. @@ -1400,6 +1519,10 @@ def __init__( :keyword auth_options: Defines the options for how the data plane API of a search service authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. :paramtype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions + :keyword semantic_search: Sets options that control the availability of semantic search. This + configuration is only possible for certain 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) self.sku = sku @@ -1418,23 +1541,24 @@ def __init__( self.disable_local_auth = disable_local_auth self.auth_options = auth_options self.private_endpoint_connections = None + self.semantic_search = semantic_search self.shared_private_link_resources = None class ShareablePrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of a resource type that has been onboarded to private link service, - supported by Azure Cognitive 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 Cognitive 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 Cognitive 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 Cognitive Search. + service and that's supported by search. :vartype description: str """ @@ -1459,16 +1583,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 - Cognitive 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 Cognitive 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 Cognitive Search. + private link service and that's supported by search. :vartype properties: ~azure.mgmt.search.models.ShareablePrivateLinkResourceProperties """ @@ -1490,7 +1614,7 @@ def __init__(self, **kwargs: Any) -> None: class SharedPrivateLinkResource(Resource): - """Describes a Shared Private Link Resource managed by the Azure Cognitive 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. @@ -1503,7 +1627,7 @@ class SharedPrivateLinkResource(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar properties: Describes the properties of a Shared Private Link Resource managed by the - Azure Cognitive Search service. + search service. :vartype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties """ @@ -1525,7 +1649,7 @@ def __init__( ) -> None: """ :keyword properties: Describes the properties of a Shared Private Link Resource managed by the - Azure Cognitive Search service. + search service. :paramtype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties """ super().__init__(**kwargs) @@ -1565,8 +1689,8 @@ 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 - Cognitive 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 resource is for. @@ -1581,12 +1705,13 @@ class SharedPrivateLinkResourceProperties(_serialization.Model): 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. Can be Pending, Approved, Rejected or - Disconnected. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :ivar status: Status of the shared private link resource. Valid values are Pending, Approved, + Rejected or Disconnected. Known values are: "Pending", "Approved", "Rejected", and + "Disconnected". :vartype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus - :ivar provisioning_state: The provisioning state of the shared private link resource. Can be - Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", "Deleting", - "Failed", "Succeeded", and "Incomplete". + :ivar provisioning_state: The provisioning state of the shared private link resource. Valid + values are Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", + "Deleting", "Failed", "Succeeded", and "Incomplete". :vartype provisioning_state: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState """ @@ -1625,12 +1750,13 @@ def __init__( 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. Can be Pending, Approved, Rejected - or Disconnected. Known values are: "Pending", "Approved", "Rejected", and "Disconnected". + :keyword status: Status of the shared private link resource. Valid values are Pending, + Approved, Rejected or Disconnected. Known values are: "Pending", "Approved", "Rejected", and + "Disconnected". :paramtype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceStatus - :keyword provisioning_state: The provisioning state of the shared private link resource. Can be - Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", "Deleting", - "Failed", "Succeeded", and "Incomplete". + :keyword provisioning_state: The provisioning state of the shared private link resource. Valid + values are Updating, Deleting, Failed, Succeeded or Incomplete. Known values are: "Updating", + "Deleting", "Failed", "Succeeded", and "Incomplete". :paramtype provisioning_state: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState """ @@ -1644,8 +1770,7 @@ def __init__( class Sku(_serialization.Model): - """Defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity - limits. + """Defines the SKU of a search service, which determines billing rate and capacity limits. :ivar name: The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 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 991db6160eec..25169d06f377 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 @@ -11,7 +11,7 @@ class AadAuthFailureMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Describes what response the data plane API of a Search service would send for requests that + """Describes what response the data plane API of a search service would send for requests that failed authentication. """ @@ -53,8 +53,8 @@ class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class PrivateLinkServiceConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the private link service connection. Can be Updating, Deleting, - Failed, Succeeded, or Incomplete. + """The provisioning state of the private link service connection. Valid values are Updating, + Deleting, Failed, Succeeded, or Incomplete. """ UPDATING = "Updating" @@ -74,8 +74,8 @@ class PrivateLinkServiceConnectionProvisioningState(str, Enum, metaclass=CaseIns class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the the private link service connection. Can be Pending, Approved, Rejected, or - Disconnected. + """Status of the the private link service connection. Valid values are Pending, Approved, + Rejected, or Disconnected. """ PENDING = "Pending" @@ -117,33 +117,49 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SearchEncryptionComplianceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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'. + """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 number of non customer encrypted + """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 1 non customer encrypted resources.""" + """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 having one or more non customer encrypted + """Describes how a search service should enforce having one or more non-customer-encrypted resources. """ DISABLED = "Disabled" - """No enforcement will be made and the search service can have non customer encrypted resources.""" + """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 there are one or more non customer encrypted + """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 ranking. This configuration is only + possible for certain search SKUs in certain locations. + """ + + DISABLED = "disabled" + """Indicates that semantic ranking is disabled for the search service.""" + FREE = "free" + """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 ranking on a search service as a billable feature, with higher throughput and + #: volume of semantic ranking requests.""" + + class SearchServiceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the search service. Possible values include: 'running': The search service is running and no provisioning operations are underway. 'provisioning': The search service is @@ -152,9 +168,9 @@ class SearchServiceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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. If your - service is in the degraded, disabled, or error states, it means the Azure Cognitive 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 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" @@ -170,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): @@ -183,8 +197,8 @@ class SharedPrivateLinkResourceAsyncOperationResult(str, Enum, metaclass=CaseIns class SharedPrivateLinkResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the shared private link resource. Can be Updating, Deleting, Failed, - Succeeded or Incomplete. + """The provisioning state of the shared private link resource. Valid values are Updating, + Deleting, Failed, Succeeded or Incomplete. """ UPDATING = "Updating" @@ -195,7 +209,9 @@ class SharedPrivateLinkResourceProvisioningState(str, Enum, metaclass=CaseInsens class SharedPrivateLinkResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected.""" + """Status of the shared private link resource. Valid values are Pending, Approved, Rejected or + Disconnected. + """ PENDING = "Pending" APPROVED = "Approved" @@ -214,20 +230,20 @@ class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ FREE = "free" - """Free tier, with no SLA guarantees and a subset of features offered to paid tiers.""" + """Free tier, with no SLA guarantees and a subset of the features offered on billable tiers.""" BASIC = "basic" - """Paid tier dedicated service with up to 3 replicas.""" + """Billable tier for a dedicated service having up to 3 replicas.""" STANDARD = "standard" - """Paid tier dedicated service with up to 12 partitions and 12 replicas.""" + """Billable tier for a dedicated service having up to 12 partitions and 12 replicas.""" STANDARD2 = "standard2" """Similar to 'standard', but with more capacity per search unit.""" STANDARD3 = "standard3" """The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 partitions #: with more indexes if you also set the hostingMode property to 'highDensity').""" STORAGE_OPTIMIZED_L1 = "storage_optimized_l1" - """Paid tier dedicated service that supports 1TB per partition, up to 12 partitions.""" + """Billable tier for a dedicated service that supports 1TB per partition, up to 12 partitions.""" STORAGE_OPTIMIZED_L2 = "storage_optimized_l2" - """Paid tier dedicated service that supports 2TB per partition, up to 12 partitions.""" + """Billable tier for a dedicated service that supports 2TB per partition, up to 12 partitions.""" class UnavailableNameReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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 b7967f39c207..b96a319c2e09 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 @@ -13,6 +13,8 @@ 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 ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -26,6 +28,8 @@ "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", "SharedPrivateLinkResourcesOperations", + "UsagesOperations", + "SearchManagementClientOperationsMixin", ] __all__.extend([p for p in _patch_all if p not in __all__]) _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 3af98f16d85a..bdef45e9fc77 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 @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ( @@ -26,12 +25,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import SearchManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +59,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +84,7 @@ def build_regenerate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +99,7 @@ def build_regenerate_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -144,13 +139,16 @@ 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 Cognitive Search service. + """Gets the primary and secondary admin API keys for the specified search service. + + .. seealso:: + - https://aka.ms/search-manage :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -171,9 +169,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None @@ -193,8 +189,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -226,11 +223,14 @@ def regenerate( """Regenerates either the primary or secondary admin API key. You can only regenerate one key at a time. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. @@ -254,9 +254,7 @@ def regenerate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None @@ -277,8 +275,9 @@ def regenerate( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 0db127672e2a..72f79afe75d9 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request +from .._vendor import SearchManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,9 +86,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -144,8 +137,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 b935d3cc8fad..f028c8a6950c 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -28,12 +28,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import SearchManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +49,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -71,7 +67,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,7 +94,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +111,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +136,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +153,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +177,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +191,7 @@ def build_list_by_service_request( "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -241,14 +237,17 @@ def update( ) -> _models.PrivateEndpointConnection: """Updates a Private Endpoint connection to the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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. @@ -279,14 +278,17 @@ def update( ) -> _models.PrivateEndpointConnection: """Updates a Private Endpoint connection to the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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. @@ -315,17 +317,20 @@ def update( ) -> _models.PrivateEndpointConnection: """Updates a Private Endpoint connection to the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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 model type or a IO type. Required. + update. Is either a PrivateEndpointConnection type or a IO type. Required. :type private_endpoint_connection: ~azure.mgmt.search.models.PrivateEndpointConnection or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -349,9 +354,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) @@ -361,7 +364,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(private_endpoint_connection, (IO, bytes)): + if isinstance(private_endpoint_connection, (IOBase, bytes)): _content = private_endpoint_connection else: _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") @@ -383,8 +386,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -416,14 +420,17 @@ def get( """Gets the details of the private endpoint connection to the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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: @@ -444,9 +451,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None @@ -467,8 +472,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -499,14 +505,17 @@ def delete( ) -> Optional[_models.PrivateEndpointConnection]: """Disconnects the private endpoint connection and deletes it from the search service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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: @@ -527,9 +536,7 @@ def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) _client_request_id = None @@ -550,8 +557,9 @@ def delete( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -583,11 +591,14 @@ def list_by_service( ) -> Iterable["_models.PrivateEndpointConnection"]: """Gets a list of all private endpoint connections in the given service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -601,9 +612,7 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -661,8 +670,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 ab8eaeaa4281..b1d791c7cfc7 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import SearchManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -52,7 +47,7 @@ def build_list_supported_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +61,7 @@ def build_list_supported_request( "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,11 +103,14 @@ def list_supported( ) -> Iterable["_models.PrivateLinkResource"]: """Gets a list of all supported private link resource types for the given service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -125,9 +123,7 @@ def list_supported( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -185,8 +181,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 cf19c6af0e6f..f208b473e9d2 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 @@ -6,7 +6,6 @@ # 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, TypeVar import urllib.parse @@ -28,12 +27,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import SearchManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -53,7 +48,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +63,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,7 +87,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +101,7 @@ def build_list_by_search_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +126,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +141,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -190,11 +185,14 @@ def create( """Generates a new query key for the specified search service. You can create up to 50 query keys per service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 @@ -217,9 +215,7 @@ def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.QueryKey] = kwargs.pop("cls", None) _client_request_id = None @@ -240,8 +236,9 @@ def create( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -269,13 +266,16 @@ 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 Cognitive Search service. + """Returns the list of query API keys for the given search service. + + .. seealso:: + - https://aka.ms/search-manage :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -288,9 +288,7 @@ def list_by_search_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -348,8 +346,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -377,11 +376,14 @@ def delete( # pylint: disable=inconsistent-return-statements """Deletes the specified query key. Unlike admin keys, query keys are not regenerated. The process for regenerating a query key is to delete and then recreate it. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. @@ -405,9 +407,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None @@ -428,8 +428,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 new file mode 100644 index 000000000000..617e8288ee20 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_search_management_client_operations.py @@ -0,0 +1,147 @@ +# 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. +# 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, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +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 .. import models as _models +from .._serialization import Serializer +from .._vendor import SearchManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_usage_by_subscription_sku_request( + location: str, sku_name: str, subscription_id: str, *, client_request_id: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "skuName": _SERIALIZER.url("sku_name", sku_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SearchManagementClientOperationsMixin(SearchManagementClientMixinABC): + @distributed_trace + def usage_by_subscription_sku( + self, + location: str, + sku_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> _models.QuotaUsageResult: + """Gets the quota usage for a search SKU in the given subscription. + + .. seealso:: + - https://aka.ms/search-manage + + :param location: The unique location name for a Microsoft Azure geographic region. Required. + :type location: str + :param sku_name: The unique SKU name that identifies a billable tier. Required. + :type sku_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: QuotaUsageResult or the result of cls(response) + :rtype: ~azure.mgmt.search.models.QuotaUsageResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.QuotaUsageResult] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_usage_by_subscription_sku_request( + location=location, + sku_name=sku_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.usage_by_subscription_sku.metadata["url"], + 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("QuotaUsageResult", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + usage_by_subscription_sku.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}" + } 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 cc4f88938792..768d1ce1afee 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 @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from io import IOBase import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,7 +31,7 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import SearchManagementClientMixinABC, _convert_request if sys.version_info >= (3, 8): from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports @@ -54,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -69,7 +70,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -110,7 +111,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +151,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +189,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,7 +221,7 @@ def build_list_by_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +249,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,7 +268,7 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") type = "searchServices" @@ -280,7 +281,7 @@ def build_check_name_availability_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -333,9 +334,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -345,7 +344,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(service, (IO, bytes)): + if isinstance(service, (IOBase, bytes)): _content = service else: _json = self._serialize.body(service, "SearchService") @@ -366,8 +365,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -405,15 +405,18 @@ def begin_create_or_update( """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. + :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. :type service: ~azure.mgmt.search.models.SearchService @@ -451,15 +454,18 @@ def begin_create_or_update( """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. + :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. :type service: IO @@ -495,18 +501,21 @@ def begin_create_or_update( """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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. + :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 model - type or a IO type. Required. + :param service: The definition of the search service to create or update. Is either a + SearchService type or a IO type. Required. :type service: ~azure.mgmt.search.models.SearchService or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -530,9 +539,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -591,10 +598,13 @@ def update( ) -> _models.SearchService: """Updates an existing search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 @@ -623,10 +633,13 @@ def update( ) -> _models.SearchService: """Updates an existing search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 @@ -653,13 +666,16 @@ def update( ) -> _models.SearchService: """Updates an existing search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 model type or a IO - type. Required. + :param service: The definition of the search service to update. Is either a SearchServiceUpdate + type or a IO type. Required. :type service: ~azure.mgmt.search.models.SearchServiceUpdate or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -683,9 +699,7 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -695,7 +709,7 @@ def update( content_type = content_type or "application/json" _json = None _content = None - if isinstance(service, (IO, bytes)): + if isinstance(service, (IOBase, bytes)): _content = service else: _json = self._serialize.body(service, "SearchServiceUpdate") @@ -716,8 +730,9 @@ def update( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -747,11 +762,14 @@ def get( ) -> _models.SearchService: """Gets the search service with the given name in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -772,9 +790,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None @@ -794,8 +810,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -825,11 +842,14 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a search service in the given resource group, along with its associated resources. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -850,9 +870,7 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None @@ -872,8 +890,9 @@ def delete( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -898,6 +917,9 @@ def list_by_resource_group( ) -> Iterable["_models.SearchService"]: """Gets a list of all Search services in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str @@ -912,9 +934,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -971,8 +991,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -994,6 +1015,9 @@ def list_by_subscription( ) -> Iterable["_models.SearchService"]: """Gets a list of all Search services in the given subscription. + .. seealso:: + - https://aka.ms/search-manage + :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -1005,9 +1029,7 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -1063,8 +1085,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1089,6 +1112,9 @@ def check_name_availability( must be globally unique since they are part of the service URI (https://:code:``.search.windows.net). + .. seealso:: + - https://aka.ms/search-manage + :param name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. @@ -1116,9 +1142,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) type: Literal["searchServices"] = kwargs.pop("type", "searchServices") cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) @@ -1142,8 +1166,9 @@ def check_name_availability( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 fd9dad1cbe97..d2d2291b0be8 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 @@ -6,7 +6,7 @@ # 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 io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -30,12 +30,8 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +from .._vendor import SearchManagementClientMixinABC, _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +51,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -73,7 +69,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -117,7 +113,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -159,7 +155,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -183,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: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +193,7 @@ def build_list_by_service_request( "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -249,9 +245,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -261,7 +255,7 @@ def _create_or_update_initial( content_type = content_type or "application/json" _json = None _content = None - if isinstance(shared_private_link_resource, (IO, bytes)): + if isinstance(shared_private_link_resource, (IOBase, bytes)): _content = shared_private_link_resource else: _json = self._serialize.body(shared_private_link_resource, "SharedPrivateLinkResource") @@ -283,8 +277,9 @@ def _create_or_update_initial( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -321,14 +316,17 @@ def begin_create_or_update( """Initiates the creation or update of a shared private link resource managed by the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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. @@ -368,14 +366,17 @@ def begin_create_or_update( """Initiates the creation or update of a shared private link resource managed by the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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. @@ -413,17 +414,20 @@ def begin_create_or_update( """Initiates the creation or update of a shared private link resource managed by the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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 model type or a IO type. Required. + create or update. Is either a SharedPrivateLinkResource type or a IO type. Required. :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource or IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -447,9 +451,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -510,14 +512,17 @@ def get( """Gets the details of the shared private link resource managed by the search service in the given resource group. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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: @@ -538,9 +543,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) _client_request_id = None @@ -561,8 +564,9 @@ def get( 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -601,9 +605,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None @@ -624,8 +626,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -652,14 +655,17 @@ def begin_delete( ) -> LROPoller[None]: """Initiates the deletion of the shared private link resource from the search service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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 Cognitive 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: @@ -679,9 +685,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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) @@ -735,11 +739,14 @@ def list_by_service( ) -> Iterable["_models.SharedPrivateLinkResource"]: """Gets a list of all shared private link resources managed by the given service. + .. seealso:: + - https://aka.ms/search-manage + :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. :type resource_group_name: str - :param search_service_name: The name of the Azure Cognitive 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: @@ -753,9 +760,7 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-09-01"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) + 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 = { @@ -813,8 +818,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response 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 new file mode 100644 index 000000000000..b0e2b806ce51 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_usages_operations.py @@ -0,0 +1,187 @@ +# 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. +# 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, Callable, Dict, Iterable, Optional, TypeVar +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.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 .. import models as _models +from .._serialization import Serializer +from .._vendor import SearchManagementClientMixinABC, _convert_request + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_subscription_request( + location: str, subscription_id: str, *, client_request_id: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages" + ) # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class UsagesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`usages` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = 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_subscription( + self, + location: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> Iterable["_models.QuotaUsageResult"]: + """Gets a list of all Search quota usages in the given subscription. + + .. seealso:: + - https://aka.ms/search-manage + + :param location: The unique location name for a Microsoft Azure geographic region. Required. + :type location: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either QuotaUsageResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.QuotaUsageResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.QuotaUsagesListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_list_by_subscription_request( + location=location, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata["url"], + 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("QuotaUsagesListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages" + } 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 f84dbc7b23c6..7298755a0ac9 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 @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/CreateOrUpdateSharedPrivateLinkResource.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 1703b4283f9c..7b6945573f10 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 eb4c99f14469..a1f6ab624043 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.shared_private_link_resources.begin_delete( + client.shared_private_link_resources.begin_delete( resource_group_name="rg1", search_service_name="mysearchservice", shared_private_link_resource_name="testResource", ).result() - print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/DeleteSharedPrivateLinkResource.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 00905fc23153..7cc043d22e66 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 new file mode 100644 index 000000000000..15079a96fbc8 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/get_quota_usage.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 get_quota_usage.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.usage_by_subscription_sku( + location="westus", + sku_name="free", + ) + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 new file mode 100644 index 000000000000..badc450e1f16 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/get_quota_usages_list.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 get_quota_usages_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.usages.list_by_subscription( + location="westus", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 f9fb209d9292..8cb5e8c447f6 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetSharedPrivateLinkResource.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 f0a40c5bfba7..2490eaa9fad7 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListPrivateEndpointConnectionsByService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 3d5cb425a597..f1e4005ab2ae 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListSharedPrivateLinkResourcesByService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 1d0025e3a9de..9fb370e9bfb1 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/ListSupportedPrivateLinkResources.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/ListSupportedPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/operations_list.py b/sdk/search/azure-mgmt-search/generated_samples/operations_list.py index 824242e1cfc3..46decc33c902 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/operations_list.py +++ b/sdk/search/azure-mgmt-search/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/OperationsList.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 e3599986c349..9e075e6442cd 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 @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 0862edaca7d8..e4ccf0282155 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceAuthOptions.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 d00cee29931b..501642741a82 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 @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceDisableLocalAuth.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 2f9941264396..3d8052de2742 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 ca81bd351079..2d43e1c57126 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.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 df9e485e9c49..683844a47c55 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 @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchCreateOrUpdateServiceWithCmkEnforcement.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 b3fb30cf4fec..aa3ccd3bd68b 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceWithIdentity.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 new file mode 100644 index 000000000000..5cbede35b9c2 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_with_semantic_search.py @@ -0,0 +1,47 @@ +# 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 search_create_or_update_with_semantic_search.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", "partitionCount": 1, "replicaCount": 3, "semanticSearch": "free"}, + "sku": {"name": "standard"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 69beedfff28a..2725bc49acbc 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateQueryKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 73fe4287a18c..4cf27d14d17f 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 @@ -29,14 +29,13 @@ def main(): subscription_id="subid", ) - response = client.query_keys.delete( + client.query_keys.delete( resource_group_name="rg1", search_service_name="mysearchservice", key="", ) - print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchDeleteQueryKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 0dcfa2cbe1d6..7dc1bbcf9101 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 @@ -29,13 +29,12 @@ def main(): subscription_id="subid", ) - response = client.services.delete( + client.services.delete( resource_group_name="rg1", search_service_name="mysearchservice", ) - print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchDeleteService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 7db1238bd873..d32bc1bc0a14 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetAdminKeys.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 09df6af3aa06..23e214d9765f 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 @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchGetService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 fc8f51bc709c..e1f8ab277e8e 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 @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListQueryKeysBySearchService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 0ada50f806a2..9e8d478a3e3c 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 @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListServicesByResourceGroup.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 d9b85d8beb45..858f87f49446 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 @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchListServicesBySubscription.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 0f33a958c13f..2fefdf1e05ac 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchRegenerateAdminKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 6e377951241c..a3d80d8a7079 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 cefac91e76d2..7b8d9bdbbb9e 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 @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceAuthOptions.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 880e0e707bf4..c500cb2d3897 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceDisableLocalAuth.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 1d095150ca08..fda3eb500b64 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 a1c03d02847b..7a435705ff25 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 @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.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 2547cdd49c40..ed361bcfb2ff 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 @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToRemoveIdentity.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-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 720191edab95..708deb8c8184 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 @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceWithCmkEnforcement.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/SearchUpdateServiceWithCmkEnforcement.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 new file mode 100644 index 000000000000..b79877c0859a --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_with_semantic_search.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. +# -------------------------------------------------------------------------- + +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_semantic_search.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": {"replicaCount": 2, "semanticSearch": "standard"}, + "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/stable/2023-11-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 44510934209a..9e6c2b3d2585 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 @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/UpdatePrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/UpdatePrivateEndpointConnection.json if __name__ == "__main__": main()