diff --git a/sdk/search/azure-mgmt-search/_meta.json b/sdk/search/azure-mgmt-search/_meta.json index afd8a5d75bc0..d2ef15f3de84 100644 --- a/sdk/search/azure-mgmt-search/_meta.json +++ b/sdk/search/azure-mgmt-search/_meta.json @@ -1,11 +1,11 @@ { - "commit": "e82a24def11ffc98cc263884f9f1742c99f2df5e", + "commit": "da4ecb694176f1d7055f207283947cf81e7572dd", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "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 --tag=package-2020-03 --use=@autorest/python@6.2.1 --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.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/search/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py index c723fbb9a1ce..a55bcb4e1a94 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/__init__.py @@ -13,7 +13,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py index e82d60ebe730..24b8b8361c5c 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_configuration.py @@ -36,14 +36,14 @@ class SearchManagementClientConfiguration(Configuration): # pylint: disable=too :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. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-09-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 = kwargs.pop("api_version", "2020-03-13") # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", "2022-09-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-search/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) 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 0097be44af47..eb9cd7e82f9e 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 @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import SearchManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -22,6 +22,7 @@ PrivateLinkResourcesOperations, QueryKeysOperations, ServicesOperations, + SharedPrivateLinkResourcesOperations, ) if TYPE_CHECKING: @@ -29,7 +30,7 @@ from azure.core.credentials import TokenCredential -class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword +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. :ivar operations: Operations operations @@ -45,6 +46,9 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.search.operations.PrivateEndpointConnectionsOperations + :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations + :vartype shared_private_link_resources: + azure.mgmt.search.operations.SharedPrivateLinkResourcesOperations :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 @@ -52,7 +56,7 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :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 "2020-03-13". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-09-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 @@ -71,7 +75,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -85,6 +89,9 @@ def __init__( self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -108,15 +115,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> SearchManagementClient + def __enter__(self) -> "SearchManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> 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 7c1dedb5133d..2c170e28dbca 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,24 +38,22 @@ import re import sys import codecs +from typing import Optional, Union, AnyStr, IO, Mapping try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING +from typing import Dict, Any, cast from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - class RawDeserializer: @@ -65,8 +64,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +130,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +157,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +185,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +216,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,9 +273,9 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs): self.additional_properties = {} @@ -310,7 +307,7 @@ def enable_additional_properties_sending(cls): @classmethod def is_xml_model(cls): try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,7 +316,7 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} @@ -453,7 +450,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -606,13 +603,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +618,23 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) local_node.text = unicode_str(new_attr) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): + for k in reversed(keys): # type: ignore unflattened = {k: new_attr} new_attr = unflattened _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -675,7 +672,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -843,7 +840,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +998,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1416,7 +1413,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1441,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1543,7 +1540,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1562,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1744,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1795,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1807,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1823,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1838,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1868,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. return isodate.parse_date(attr, defaultmonth=None, defaultday=None) @@ -1886,7 +1883,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1898,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1921,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1957,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: 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 6dddc002d43d..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.0b1" +VERSION = "1.0.0b1" diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py index b953852f8cc0..6baf3d114500 100644 --- a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/__init__.py @@ -10,7 +10,7 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk diff --git a/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/_configuration.py index fdbafb341183..b5ae1b276b46 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 @@ -36,14 +36,14 @@ class SearchManagementClientConfiguration(Configuration): # pylint: disable=too :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. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2020-03-13". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-09-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 = kwargs.pop("api_version", "2020-03-13") # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", "2022-09-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 2dd2fe22d5af..5f316590f2a2 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 @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import SearchManagementClientConfiguration from .operations import ( @@ -22,6 +22,7 @@ PrivateLinkResourcesOperations, QueryKeysOperations, ServicesOperations, + SharedPrivateLinkResourcesOperations, ) if TYPE_CHECKING: @@ -29,7 +30,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyword +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. :ivar operations: Operations operations @@ -46,6 +47,9 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.search.aio.operations.PrivateEndpointConnectionsOperations + :ivar shared_private_link_resources: SharedPrivateLinkResourcesOperations operations + :vartype shared_private_link_resources: + azure.mgmt.search.aio.operations.SharedPrivateLinkResourcesOperations :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 @@ -53,7 +57,7 @@ class SearchManagementClient: # pylint: disable=client-accepts-api-version-keyw :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 "2020-03-13". Note that overriding this + :keyword api_version: Api Version. Default value is "2022-09-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 @@ -72,7 +76,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -86,6 +90,9 @@ def __init__( self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) + self.shared_private_link_resources = SharedPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. 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 5f7e85a6a72d..b7967f39c207 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 @@ -12,9 +12,10 @@ from ._services_operations import ServicesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -24,6 +25,7 @@ "ServicesOperations", "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", + "SharedPrivateLinkResourcesOperations", ] __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 417849bb6c4e..17bd173e0489 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 @@ -90,10 +90,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdminKeyResult] + ) + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -110,9 +110,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -129,7 +129,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys" + } @distributed_trace_async async def regenerate( @@ -171,10 +173,10 @@ async def regenerate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdminKeyResult] + ) + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -192,9 +194,9 @@ async def regenerate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -211,4 +213,6 @@ async def regenerate( return deserialized - regenerate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}"} # type: ignore + regenerate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}" + } 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 b722e2e982a4..59426db1af96 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 @@ -69,10 +69,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +92,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -108,7 +108,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -116,13 +116,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -135,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Search/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Search/operations"} 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 3fb1f83e5f60..56690086adeb 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 @@ -75,7 +75,7 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :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. @@ -113,7 +113,7 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :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. @@ -149,7 +149,7 @@ async def update( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :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. @@ -185,11 +185,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -217,9 +217,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -236,7 +236,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def get( @@ -247,7 +249,7 @@ async def get( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Gets the details of the private endpoint connection to the Search service in the given resource + """Gets the details of the private endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You @@ -278,10 +280,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -299,9 +301,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -318,7 +320,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def delete( @@ -329,7 +333,7 @@ async def delete( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - """Disconnects the private endpoint connection and deletes it from the Search service. + """Disconnects the private endpoint connection and deletes it from the search service. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -359,10 +363,10 @@ async def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + ) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -380,9 +384,9 @@ async def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -401,7 +405,9 @@ async def delete( return deserialized - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def list_by_service( @@ -432,10 +438,10 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -462,7 +468,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -478,7 +484,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -486,13 +492,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -505,4 +511,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections" + } 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 a8b86c64aab2..34b0497a4323 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 @@ -84,10 +84,10 @@ def list_supported( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesResult] + ) + cls: ClsType[_models.PrivateLinkResourcesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +114,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +130,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,13 +138,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourcesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -157,4 +157,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_supported.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources"} # type: ignore + list_supported.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources" + } 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 26d5e288a6a8..1c6a76a45b83 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 @@ -71,7 +71,7 @@ async def create( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.QueryKey: - """Generates a new query key for the specified Search service. You can create up to 50 query keys + """Generates a new query key for the specified search service. You can create up to 50 query keys per service. :param resource_group_name: The name of the resource group within the current subscription. You @@ -101,10 +101,10 @@ async def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryKey] + ) + cls: ClsType[_models.QueryKey] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -122,9 +122,9 @@ async def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -141,7 +141,9 @@ async def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}" + } @distributed_trace def list_by_search_service( @@ -170,10 +172,10 @@ def list_by_search_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListQueryKeysResult] + ) + cls: ClsType[_models.ListQueryKeysResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -200,7 +202,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -216,7 +218,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -224,13 +226,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ListQueryKeysResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -243,7 +245,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_search_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys"} # type: ignore + list_by_search_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -285,10 +289,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -306,9 +310,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -321,4 +325,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}" + } 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 cd7835aab771..da2d6969fc55 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 @@ -87,11 +87,11 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -118,9 +118,9 @@ async def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -137,11 +137,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("SearchService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @overload async def begin_create_or_update( @@ -154,7 +156,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -167,7 +169,7 @@ async def begin_create_or_update( 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. + :param service: The definition of the search service to create or update. Required. :type service: ~azure.mgmt.search.models.SearchService :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -200,7 +202,7 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -213,7 +215,7 @@ async def begin_create_or_update( 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. + :param service: The definition of the search service to create or update. Required. :type service: IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -244,7 +246,7 @@ async def begin_create_or_update( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> AsyncLROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -257,7 +259,7 @@ async def begin_create_or_update( 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 + :param service: The definition of the search service to create or update. Is either a model 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. @@ -282,16 +284,16 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, search_service_name=search_service_name, service=service, @@ -312,7 +314,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -324,30 +326,32 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @overload async def update( self, resource_group_name: str, search_service_name: str, - service: _models.SearchService, + service: _models.SearchServiceUpdate, search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :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. :type search_service_name: str - :param service: The definition of the Search service to update. Required. - :type service: ~azure.mgmt.search.models.SearchService + :param service: The definition of the search service to update. Required. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -371,14 +375,14 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :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. :type search_service_name: str - :param service: The definition of the Search service to update. Required. + :param service: The definition of the search service to update. Required. :type service: IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -397,20 +401,20 @@ async def update( self, resource_group_name: str, search_service_name: str, - service: Union[_models.SearchService, IO], + service: Union[_models.SearchServiceUpdate, IO], search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :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. :type search_service_name: str - :param service: The definition of the Search service to update. Is either a model type or a IO + :param service: The definition of the search service to update. Is either a model type or a IO type. Required. - :type service: ~azure.mgmt.search.models.SearchService or IO + :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: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -433,11 +437,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -448,7 +452,7 @@ async def update( if isinstance(service, (IO, bytes)): _content = service else: - _json = self._serialize.body(service, "SearchService") + _json = self._serialize.body(service, "SearchServiceUpdate") request = build_update_request( resource_group_name=resource_group_name, @@ -464,9 +468,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -483,7 +487,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace_async async def get( @@ -493,7 +499,7 @@ async def get( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.SearchService: - """Gets the Search service with the given name in the given resource group. + """Gets the search service with the given name in the given resource group. :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. @@ -520,10 +526,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -540,9 +546,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -559,7 +565,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -569,7 +577,7 @@ async def delete( # pylint: disable=inconsistent-return-statements search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> None: - """Deletes a Search service in the given resource group, along with its associated resources. + """Deletes a search service in the given resource group, along with its associated resources. :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. @@ -596,10 +604,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -616,9 +624,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -631,7 +639,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace def list_by_resource_group( @@ -656,10 +666,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchServiceListResult] + ) + cls: ClsType[_models.SearchServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -685,7 +695,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -701,7 +711,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -709,13 +719,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SearchServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -728,7 +738,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices" + } @distributed_trace def list_by_subscription( @@ -747,10 +759,10 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchServiceListResult] + ) + cls: ClsType[_models.SearchServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -775,7 +787,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -791,7 +803,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -799,13 +811,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("SearchServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -818,7 +830,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices"} @distributed_trace_async async def check_name_availability( @@ -827,11 +839,11 @@ async def check_name_availability( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Checks whether or not the given Search service name is available for use. Search service names + """Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://:code:``.search.windows.net). - :param name: The Search service name to validate. Search service names must only contain + :param name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. :type name: str @@ -858,12 +870,12 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - type = kwargs.pop("type", "searchServices") # type: Literal["searchServices"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + type: Literal["searchServices"] = kwargs.pop("type", "searchServices") + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -882,9 +894,9 @@ async def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -901,4 +913,6 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability" + } 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 new file mode 100644 index 000000000000..e5fc3dc81da5 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/aio/operations/_shared_private_link_resources_operations.py @@ -0,0 +1,670 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._shared_private_link_resources_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_service_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, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SharedPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.aio.SearchManagementClient`'s + :attr:`shared_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = 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") + + async def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO], + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> Optional[_models.SharedPrivateLinkResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = 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) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shared_private_link_resource, (IO, bytes)): + _content = shared_private_link_resource + else: + _json = self._serialize.body(shared_private_link_resource, "SharedPrivateLinkResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: _models.SharedPrivateLinkResource, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :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. + :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. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SharedPrivateLinkResource or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: IO, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :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. + :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. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: IO + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SharedPrivateLinkResource or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO], + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :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. + :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. + :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. + :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: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SharedPrivateLinkResource or the + result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + shared_private_link_resource=shared_private_link_resource, + search_management_request_options=search_management_request_options, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Gets the details of the shared private link resource managed by the search service in the given + resource group. + + :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. + :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. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedPrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource + :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: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> None: + error_map = { + 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: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Initiates the deletion of the shared private link resource from the search service. + + :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. + :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. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + search_management_request_options=search_management_request_options, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> AsyncIterable["_models.SharedPrivateLinkResource"]: + """Gets a list of all shared private link resources managed by the given service. + + :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. + :type search_service_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SharedPrivateLinkResourceListResult] = 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_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.list_by_service.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("SharedPrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources" + } 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 2ef8cdcab221..158a6e55e1b2 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 @@ -7,9 +7,12 @@ # -------------------------------------------------------------------------- from ._models_py3 import AdminKeyResult +from ._models_py3 import AsyncOperationResult from ._models_py3 import CheckNameAvailabilityInput from ._models_py3 import CheckNameAvailabilityOutput from ._models_py3 import CloudErrorBody +from ._models_py3 import DataPlaneAadOrApiKeyAuthOption +from ._models_py3 import DataPlaneAuthOptions from ._models_py3 import Identity from ._models_py3 import IpRule from ._models_py3 import ListQueryKeysResult @@ -30,26 +33,41 @@ from ._models_py3 import SearchManagementRequestOptions from ._models_py3 import SearchService from ._models_py3 import SearchServiceListResult +from ._models_py3 import SearchServiceUpdate +from ._models_py3 import ShareablePrivateLinkResourceProperties +from ._models_py3 import ShareablePrivateLinkResourceType +from ._models_py3 import SharedPrivateLinkResource +from ._models_py3 import SharedPrivateLinkResourceListResult +from ._models_py3 import SharedPrivateLinkResourceProperties from ._models_py3 import Sku +from ._models_py3 import TrackedResource +from ._search_management_client_enums import AadAuthFailureMode from ._search_management_client_enums import AdminKeyKind from ._search_management_client_enums import HostingMode from ._search_management_client_enums import IdentityType +from ._search_management_client_enums import PrivateLinkServiceConnectionProvisioningState from ._search_management_client_enums import PrivateLinkServiceConnectionStatus from ._search_management_client_enums import ProvisioningState from ._search_management_client_enums import PublicNetworkAccess from ._search_management_client_enums import SearchServiceStatus +from ._search_management_client_enums import SharedPrivateLinkResourceAsyncOperationResult +from ._search_management_client_enums import SharedPrivateLinkResourceProvisioningState +from ._search_management_client_enums import SharedPrivateLinkResourceStatus from ._search_management_client_enums import SkuName from ._search_management_client_enums import UnavailableNameReason from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ "AdminKeyResult", + "AsyncOperationResult", "CheckNameAvailabilityInput", "CheckNameAvailabilityOutput", "CloudErrorBody", + "DataPlaneAadOrApiKeyAuthOption", + "DataPlaneAuthOptions", "Identity", "IpRule", "ListQueryKeysResult", @@ -70,14 +88,26 @@ "SearchManagementRequestOptions", "SearchService", "SearchServiceListResult", + "SearchServiceUpdate", + "ShareablePrivateLinkResourceProperties", + "ShareablePrivateLinkResourceType", + "SharedPrivateLinkResource", + "SharedPrivateLinkResourceListResult", + "SharedPrivateLinkResourceProperties", "Sku", + "TrackedResource", + "AadAuthFailureMode", "AdminKeyKind", "HostingMode", "IdentityType", + "PrivateLinkServiceConnectionProvisioningState", "PrivateLinkServiceConnectionStatus", "ProvisioningState", "PublicNetworkAccess", "SearchServiceStatus", + "SharedPrivateLinkResourceAsyncOperationResult", + "SharedPrivateLinkResourceProvisioningState", + "SharedPrivateLinkResourceStatus", "SkuName", "UnavailableNameReason", ] 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 24b6380225d8..31f302b09411 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 @@ -7,13 +7,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, TYPE_CHECKING, Union +import sys +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models +JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object class AdminKeyResult(_serialization.Model): @@ -21,9 +28,9 @@ class AdminKeyResult(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar primary_key: The primary admin API key of the Search service. + :ivar primary_key: The primary admin API key of the search service. :vartype primary_key: str - :ivar secondary_key: The secondary admin API key of the Search service. + :ivar secondary_key: The secondary admin API key of the search service. :vartype secondary_key: str """ @@ -44,6 +51,31 @@ def __init__(self, **kwargs): self.secondary_key = None +class AsyncOperationResult(_serialization.Model): + """The details of a long running asynchronous shared private link resource operation. + + :ivar status: The current status of the long running asynchronous shared private link resource + operation. Known values are: "Running", "Succeeded", and "Failed". + :vartype status: str or ~azure.mgmt.search.models.SharedPrivateLinkResourceAsyncOperationResult + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + } + + def __init__( + self, *, status: Optional[Union[str, "_models.SharedPrivateLinkResourceAsyncOperationResult"]] = None, **kwargs + ): + """ + :keyword status: The current status of the long running asynchronous shared private link + resource operation. Known values are: "Running", "Succeeded", and "Failed". + :paramtype status: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceAsyncOperationResult + """ + super().__init__(**kwargs) + self.status = status + + class CheckNameAvailabilityInput(_serialization.Model): """Input of check name availability API. @@ -51,7 +83,7 @@ class CheckNameAvailabilityInput(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar name: The Search service name to validate. Search service names must only contain + :ivar name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. :vartype name: str @@ -74,7 +106,7 @@ class CheckNameAvailabilityInput(_serialization.Model): def __init__(self, *, name: str, **kwargs): """ - :keyword name: The Search service name to validate. Search service names must only contain + :keyword name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. :paramtype name: str @@ -171,6 +203,64 @@ def __init__( self.details = details +class DataPlaneAadOrApiKeyAuthOption(_serialization.Model): + """Indicates that either the API key or an access token from Azure Active Directory can be used for authentication. + + :ivar aad_auth_failure_mode: Describes what response the data plane API of a Search service + would send for requests that failed authentication. Known values are: "http403" and + "http401WithBearerChallenge". + :vartype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode + """ + + _attribute_map = { + "aad_auth_failure_mode": {"key": "aadAuthFailureMode", "type": "str"}, + } + + def __init__(self, *, aad_auth_failure_mode: Optional[Union[str, "_models.AadAuthFailureMode"]] = None, **kwargs): + """ + :keyword aad_auth_failure_mode: Describes what response the data plane API of a Search service + would send for requests that failed authentication. Known values are: "http403" and + "http401WithBearerChallenge". + :paramtype aad_auth_failure_mode: str or ~azure.mgmt.search.models.AadAuthFailureMode + """ + super().__init__(**kwargs) + self.aad_auth_failure_mode = aad_auth_failure_mode + + +class DataPlaneAuthOptions(_serialization.Model): + """Defines the options for how the data plane API of a Search service authenticates requests. 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. + :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. + :vartype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption + """ + + _attribute_map = { + "api_key_only": {"key": "apiKeyOnly", "type": "object"}, + "aad_or_api_key": {"key": "aadOrApiKey", "type": "DataPlaneAadOrApiKeyAuthOption"}, + } + + def __init__( + self, + *, + api_key_only: Optional[JSON] = None, + aad_or_api_key: Optional["_models.DataPlaneAadOrApiKeyAuthOption"] = None, + **kwargs + ): + """ + :keyword api_key_only: Indicates that only the API key needs to 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. + :paramtype aad_or_api_key: ~azure.mgmt.search.models.DataPlaneAadOrApiKeyAuthOption + """ + super().__init__(**kwargs) + self.api_key_only = api_key_only + self.aad_or_api_key = aad_or_api_key + + class Identity(_serialization.Model): """Identity for the resource. @@ -178,9 +268,9 @@ class Identity(_serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar principal_id: The principal ID of resource identity. + :ivar principal_id: The principal ID of the system-assigned identity of the search service. :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. + :ivar tenant_id: The tenant ID of the system-assigned identity of the search service. :vartype tenant_id: str :ivar type: The identity type. Required. Known values are: "None" and "SystemAssigned". :vartype type: str or ~azure.mgmt.search.models.IdentityType @@ -385,17 +475,53 @@ def __init__(self, **kwargs): self.next_link = None -class PrivateEndpointConnection(_serialization.Model): +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class PrivateEndpointConnection(Resource): """Describes an existing Private Endpoint connection to the Azure Cognitive Search service. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ID of the private endpoint connection. This can be used with the Azure Resource - Manager to link resources together. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the private endpoint connection. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :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. @@ -422,9 +548,6 @@ def __init__(self, *, properties: Optional["_models.PrivateEndpointConnectionPro :paramtype properties: ~azure.mgmt.search.models.PrivateEndpointConnectionProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None self.properties = properties @@ -468,6 +591,14 @@ class PrivateEndpointConnectionProperties(_serialization.Model): Link Service connection to the Azure Private Endpoint. :vartype private_link_service_connection_state: ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + :ivar group_id: The group id 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". + :vartype provisioning_state: str or + ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState """ _attribute_map = { @@ -476,6 +607,8 @@ class PrivateEndpointConnectionProperties(_serialization.Model): "key": "privateLinkServiceConnectionState", "type": "PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState", }, + "group_id": {"key": "groupId", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, } def __init__( @@ -485,6 +618,8 @@ def __init__( private_link_service_connection_state: Optional[ "_models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState" ] = None, + group_id: Optional[str] = None, + provisioning_state: Optional[Union[str, "_models.PrivateLinkServiceConnectionProvisioningState"]] = None, **kwargs ): """ @@ -495,10 +630,20 @@ def __init__( Private Link Service connection to the Azure Private Endpoint. :paramtype private_link_service_connection_state: ~azure.mgmt.search.models.PrivateEndpointConnectionPropertiesPrivateLinkServiceConnectionState + :keyword group_id: The group id 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". + :paramtype provisioning_state: str or + ~azure.mgmt.search.models.PrivateLinkServiceConnectionProvisioningState """ super().__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state + self.group_id = group_id + self.provisioning_state = provisioning_state class PrivateEndpointConnectionPropertiesPrivateEndpoint(_serialization.Model): @@ -564,16 +709,18 @@ def __init__( self.actions_required = actions_required -class PrivateLinkResource(_serialization.Model): +class PrivateLinkResource(Resource): """Describes a supported private link resource for the Azure Cognitive Search service. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ID of the private link resource. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: The name of the private link resource. + :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :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. @@ -597,14 +744,11 @@ class PrivateLinkResource(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None self.properties = None class PrivateLinkResourceProperties(_serialization.Model): - """Describes the properties of a supported private link resource for the Azure Cognitive Search service. + """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. Variables are only populated by the server, and will be ignored when sending a request. @@ -614,18 +758,27 @@ class PrivateLinkResourceProperties(_serialization.Model): :vartype required_members: list[str] :ivar required_zone_names: The list of required DNS zone names of the private link resource. :vartype required_zone_names: list[str] + :ivar shareable_private_link_resource_types: The list of resources that are onboarded to + private link service, that are supported by Azure Cognitive Search. + :vartype shareable_private_link_resource_types: + list[~azure.mgmt.search.models.ShareablePrivateLinkResourceType] """ _validation = { "group_id": {"readonly": True}, "required_members": {"readonly": True}, "required_zone_names": {"readonly": True}, + "shareable_private_link_resource_types": {"readonly": True}, } _attribute_map = { "group_id": {"key": "groupId", "type": "str"}, "required_members": {"key": "requiredMembers", "type": "[str]"}, "required_zone_names": {"key": "requiredZoneNames", "type": "[str]"}, + "shareable_private_link_resource_types": { + "key": "shareablePrivateLinkResourceTypes", + "type": "[ShareablePrivateLinkResourceType]", + }, } def __init__(self, **kwargs): @@ -634,6 +787,7 @@ def __init__(self, **kwargs): self.group_id = None self.required_members = None self.required_zone_names = None + self.shareable_private_link_resource_types = None class PrivateLinkResourcesResult(_serialization.Model): @@ -687,104 +841,323 @@ def __init__(self, **kwargs): self.key = None -class Resource(_serialization.Model): - """Base type for all Azure resources. +class SearchManagementRequestOptions(_serialization.Model): + """Parameter group. + + :ivar client_request_id: A client-generated GUID value that identifies this request. If + specified, this will be included in response information as a way to track the request. + :vartype client_request_id: str + """ + + _attribute_map = { + "client_request_id": {"key": "clientRequestId", "type": "str"}, + } + + def __init__(self, *, client_request_id: Optional[str] = None, **kwargs): + """ + :keyword client_request_id: A client-generated GUID value that identifies this request. If + specified, this will be included in response information as a way to track the request. + :paramtype client_request_id: str + """ + super().__init__(**kwargs) + self.client_request_id = client_request_id + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ID of the resource. This can be used with the Azure Resource Manager to link - resources together. + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar location: The geographic location of the resource. This must be one of the supported and - registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). - This property is required when creating a new resource. + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar tags: Tags to help categorize the resource in the Azure portal. + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "location": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + } + + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + """ + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + """ + super().__init__(**kwargs) + self.tags = tags + self.location = location + + +class SearchService(TrackedResource): # pylint: disable=too-many-instance-attributes + """Describes an Azure Cognitive Search service and its current state. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar tags: Resource tags. :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar sku: The SKU of the Search Service, which determines price tier and capacity limits. This + property is required when creating a new Search Service. + :vartype sku: ~azure.mgmt.search.models.Sku :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.search.models.Identity + :ivar replica_count: The number of replicas in the search service. If specified, it must be a + value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. + :vartype replica_count: int + :ivar partition_count: The number of partitions in the search service; if specified, it can be + 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' + services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. + :vartype partition_count: int + :ivar hosting_mode: Applicable only for the standard3 SKU. You can set this property to enable + up to 3 high density partitions that allow up to 1000 indexes, which is much higher than the + maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either 'default' + or 'highDensity'. For all other SKUs, this value must be 'default'. Known values are: "default" + and "highDensity". + :vartype hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :ivar public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Known + values are: "enabled" and "disabled". + :vartype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error + state. 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". + :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus + :ivar status_details: The details of the search service status. + :vartype status_details: str + :ivar provisioning_state: The state of the last provisioning operation performed on the search + service. Provisioning is an intermediate state that occurs while service capacity is being + established. After capacity is set up, provisioningState changes to either 'succeeded' or + 'failed'. Client applications can poll provisioning status (the recommended polling interval is + from 30 seconds to one minute) by using the Get Search Service operation to see when an + operation is completed. If you are using the free service, this value tends to come back as + 'succeeded' directly in the call to Create search service. This is because the free service + uses capacity that is already set up. Known values are: "succeeded", "provisioning", and + "failed". + :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState + :ivar network_rule_set: Network specific rules that determine how the Azure Cognitive Search + service may be reached. + :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar disable_local_auth: When set to true, calls to the search service will not be permitted + to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' + are defined. + :vartype disable_local_auth: bool + :ivar auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :vartype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions + :ivar private_endpoint_connections: The list of private endpoint connections to the Azure + Cognitive Search service. + :vartype private_endpoint_connections: + list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure Cognitive Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "location": {"required": True}, + "replica_count": {"maximum": 12, "minimum": 1}, + "partition_count": {"maximum": 12, "minimum": 1}, + "status": {"readonly": True}, + "status_details": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "private_endpoint_connections": {"readonly": True}, + "shared_private_link_resources": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, + "location": {"key": "location", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, "identity": {"key": "identity", "type": "Identity"}, + "replica_count": {"key": "properties.replicaCount", "type": "int"}, + "partition_count": {"key": "properties.partitionCount", "type": "int"}, + "hosting_mode": {"key": "properties.hostingMode", "type": "str"}, + "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, + "status": {"key": "properties.status", "type": "str"}, + "status_details": {"key": "properties.statusDetails", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "network_rule_set": {"key": "properties.networkRuleSet", "type": "NetworkRuleSet"}, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "auth_options": {"key": "properties.authOptions", "type": "DataPlaneAuthOptions"}, + "private_endpoint_connections": { + "key": "properties.privateEndpointConnections", + "type": "[PrivateEndpointConnection]", + }, + "shared_private_link_resources": { + "key": "properties.sharedPrivateLinkResources", + "type": "[SharedPrivateLinkResource]", + }, } def __init__( self, *, - location: Optional[str] = None, + location: str, tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, identity: Optional["_models.Identity"] = None, + replica_count: int = 1, + partition_count: int = 1, + hosting_mode: Union[str, "_models.HostingMode"] = "default", + public_network_access: Union[str, "_models.PublicNetworkAccess"] = "enabled", + network_rule_set: Optional["_models.NetworkRuleSet"] = None, + disable_local_auth: Optional[bool] = None, + auth_options: Optional["_models.DataPlaneAuthOptions"] = None, **kwargs ): """ - :keyword location: The geographic location of the resource. This must be one of the supported - and registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). - This property is required when creating a new resource. - :paramtype location: str - :keyword tags: Tags to help categorize the resource in the Azure portal. + :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword location: The geo-location where the resource lives. Required. + :paramtype location: str + :keyword sku: The SKU of the Search Service, which determines price tier and capacity limits. + This property is required when creating a new Search Service. + :paramtype sku: ~azure.mgmt.search.models.Sku :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.search.models.Identity + :keyword replica_count: The number of replicas in the search service. If specified, it must be + a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic + SKU. + :paramtype replica_count: int + :keyword partition_count: The number of partitions in the search service; if specified, it can + be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For + 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 + and 3. + :paramtype partition_count: int + :keyword hosting_mode: Applicable only for the standard3 SKU. You can set this property to + enable up to 3 high density partitions that allow up to 1000 indexes, which is much higher than + the maximum indexes allowed for any other SKU. For the standard3 SKU, the value is either + 'default' or 'highDensity'. For all other SKUs, this value must be 'default'. Known values are: + "default" and "highDensity". + :paramtype hosting_mode: str or ~azure.mgmt.search.models.HostingMode + :keyword public_network_access: This value can be set to 'enabled' to avoid breaking changes on + existing customer resources and templates. If set to 'disabled', traffic over public interface + is not allowed, and private endpoint connections would be the exclusive access method. Known + values are: "enabled" 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. + :paramtype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :keyword disable_local_auth: When set to true, calls to the search service will not be + permitted to utilize API keys for authentication. This cannot be set to true if + 'dataPlaneAuthOptions' are defined. + :paramtype disable_local_auth: bool + :keyword auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :paramtype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags + super().__init__(tags=tags, location=location, **kwargs) + self.sku = sku self.identity = identity + self.replica_count = replica_count + self.partition_count = partition_count + self.hosting_mode = hosting_mode + self.public_network_access = public_network_access + self.status = None + self.status_details = None + self.provisioning_state = None + self.network_rule_set = network_rule_set + self.disable_local_auth = disable_local_auth + self.auth_options = auth_options + self.private_endpoint_connections = None + self.shared_private_link_resources = None -class SearchManagementRequestOptions(_serialization.Model): - """Parameter group. +class SearchServiceListResult(_serialization.Model): + """Response containing a list of Azure Cognitive Search services. - :ivar client_request_id: A client-generated GUID value that identifies this request. If - specified, this will be included in response information as a way to track the request. - :vartype client_request_id: str + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Search services. + :vartype value: list[~azure.mgmt.search.models.SearchService] + :ivar next_link: Request URL that can be used to query next page of search services. Returned + when the total number of requested search services exceed maximum page size. + :vartype next_link: str """ + _validation = { + "value": {"readonly": True}, + "next_link": {"readonly": True}, + } + _attribute_map = { - "client_request_id": {"key": "clientRequestId", "type": "str"}, + "value": {"key": "value", "type": "[SearchService]"}, + "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, client_request_id: Optional[str] = None, **kwargs): - """ - :keyword client_request_id: A client-generated GUID value that identifies this request. If - specified, this will be included in response information as a way to track the request. - :paramtype client_request_id: str - """ + def __init__(self, **kwargs): + """ """ super().__init__(**kwargs) - self.client_request_id = client_request_id + self.value = None + self.next_link = None -class SearchService(Resource): # pylint: disable=too-many-instance-attributes - """Describes an Azure Cognitive Search service and its current state. +class SearchServiceUpdate(Resource): # pylint: disable=too-many-instance-attributes + """The parameters used to update an Azure Cognitive Search service. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: The ID of the resource. This can be used with the Azure Resource Manager to link - resources together. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str - :ivar type: The resource type. + :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. + :vartype sku: ~azure.mgmt.search.models.Sku :ivar location: The geographic location of the resource. This must be one of the supported and registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource. @@ -793,13 +1166,10 @@ class SearchService(Resource): # pylint: disable=too-many-instance-attributes :vartype tags: dict[str, str] :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.search.models.Identity - :ivar sku: The SKU of the Search Service, which determines price tier and capacity limits. This - property is required when creating a new Search Service. - :vartype sku: ~azure.mgmt.search.models.Sku - :ivar replica_count: The number of replicas in the Search service. If specified, it must be a + :ivar replica_count: The number of replicas in the search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. :vartype replica_count: int - :ivar partition_count: The number of partitions in the Search service; if specified, it can be + :ivar partition_count: The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. :vartype partition_count: int @@ -814,37 +1184,48 @@ class SearchService(Resource): # pylint: disable=too-many-instance-attributes is not allowed, and private endpoint connections would be the exclusive access method. Known values are: "enabled" and "disabled". :vartype public_network_access: str or ~azure.mgmt.search.models.PublicNetworkAccess - :ivar status: The status of the Search service. Possible values include: 'running': The Search - service is running and no provisioning operations are underway. 'provisioning': The Search - service is being provisioned or scaled up or down. 'deleting': The Search service is being - deleted. 'degraded': The Search service is degraded. This can occur when the underlying search - units are not healthy. The Search service is most likely operational, but performance might be - slow and some requests might be dropped. 'disabled': The Search service is disabled. In this - state, the service will reject all API requests. 'error': The Search service is in an error + :ivar status: The status of the search service. Possible values include: 'running': The search + service is running and no provisioning operations are underway. 'provisioning': The search + service is being provisioned or scaled up or down. 'deleting': The search service is being + deleted. 'degraded': The search service is degraded. This can occur when the underlying search + units are not healthy. The search service is most likely operational, but performance might be + slow and some requests might be dropped. 'disabled': The search service is disabled. In this + state, the service will reject all API requests. 'error': The search service is in an error state. 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", and "error". + are: "running", "provisioning", "deleting", "degraded", "disabled", "error", and "stopped". :vartype status: str or ~azure.mgmt.search.models.SearchServiceStatus - :ivar status_details: The details of the Search service status. + :ivar status_details: The details of the search service status. :vartype status_details: str - :ivar provisioning_state: The state of the last provisioning operation performed on the Search + :ivar provisioning_state: The state of the last provisioning operation performed on the search service. Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is set up, provisioningState changes to either 'succeeded' or 'failed'. Client applications can poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service operation to see when an operation is completed. If you are using the free service, this value tends to come back as - 'succeeded' directly in the call to Create Search service. This is because the free service + 'succeeded' directly in the call to Create search service. This is because the free service uses capacity that is already set up. Known values are: "succeeded", "provisioning", and "failed". :vartype provisioning_state: str or ~azure.mgmt.search.models.ProvisioningState :ivar network_rule_set: Network specific rules that determine how the Azure Cognitive Search service may be reached. :vartype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :ivar disable_local_auth: When set to true, calls to the search service will not be permitted + to utilize API keys for authentication. This cannot be set to true if 'dataPlaneAuthOptions' + are defined. + :vartype disable_local_auth: bool + :ivar auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :vartype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions :ivar private_endpoint_connections: The list of private endpoint connections to the Azure Cognitive Search service. :vartype private_endpoint_connections: list[~azure.mgmt.search.models.PrivateEndpointConnection] + :ivar shared_private_link_resources: The list of shared private link resources managed by the + Azure Cognitive Search service. + :vartype shared_private_link_resources: + list[~azure.mgmt.search.models.SharedPrivateLinkResource] """ _validation = { @@ -857,16 +1238,17 @@ class SearchService(Resource): # pylint: disable=too-many-instance-attributes "status_details": {"readonly": True}, "provisioning_state": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, + "shared_private_link_resources": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, "location": {"key": "location", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, "identity": {"key": "identity", "type": "Identity"}, - "sku": {"key": "sku", "type": "Sku"}, "replica_count": {"key": "properties.replicaCount", "type": "int"}, "partition_count": {"key": "properties.partitionCount", "type": "int"}, "hosting_mode": {"key": "properties.hostingMode", "type": "str"}, @@ -875,27 +1257,38 @@ class SearchService(Resource): # pylint: disable=too-many-instance-attributes "status_details": {"key": "properties.statusDetails", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, "network_rule_set": {"key": "properties.networkRuleSet", "type": "NetworkRuleSet"}, + "disable_local_auth": {"key": "properties.disableLocalAuth", "type": "bool"}, + "auth_options": {"key": "properties.authOptions", "type": "DataPlaneAuthOptions"}, "private_endpoint_connections": { "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, + "shared_private_link_resources": { + "key": "properties.sharedPrivateLinkResources", + "type": "[SharedPrivateLinkResource]", + }, } def __init__( self, *, + sku: Optional["_models.Sku"] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.Identity"] = None, - sku: Optional["_models.Sku"] = None, replica_count: int = 1, partition_count: int = 1, hosting_mode: Union[str, "_models.HostingMode"] = "default", public_network_access: Union[str, "_models.PublicNetworkAccess"] = "enabled", network_rule_set: Optional["_models.NetworkRuleSet"] = None, + disable_local_auth: Optional[bool] = None, + auth_options: Optional["_models.DataPlaneAuthOptions"] = None, **kwargs ): """ + :keyword sku: The SKU of the Search Service, which determines price tier and capacity limits. + This property is required when creating a new Search Service. + :paramtype sku: ~azure.mgmt.search.models.Sku :keyword location: The geographic location of the resource. This must be one of the supported and registered Azure Geo Regions (for example, West US, East US, Southeast Asia, and so forth). This property is required when creating a new resource. @@ -904,14 +1297,11 @@ def __init__( :paramtype tags: dict[str, str] :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.search.models.Identity - :keyword sku: The SKU of the Search Service, which determines price tier and capacity limits. - This property is required when creating a new Search Service. - :paramtype sku: ~azure.mgmt.search.models.Sku - :keyword replica_count: The number of replicas in the Search service. If specified, it must be + :keyword replica_count: The number of replicas in the search service. If specified, it must be a value between 1 and 12 inclusive for standard SKUs or between 1 and 3 inclusive for basic SKU. :paramtype replica_count: int - :keyword partition_count: The number of partitions in the Search service; if specified, it can + :keyword partition_count: The number of partitions in the search service; if specified, it can be 1, 2, 3, 4, 6, or 12. Values greater than 1 are only valid for standard SKUs. For 'standard3' services with hostingMode set to 'highDensity', the allowed values are between 1 and 3. @@ -930,9 +1320,19 @@ def __init__( :keyword network_rule_set: Network specific rules that determine how the Azure Cognitive Search service may be reached. :paramtype network_rule_set: ~azure.mgmt.search.models.NetworkRuleSet + :keyword disable_local_auth: When set to true, calls to the search service will not be + permitted to utilize API keys for authentication. This cannot be set to true if + 'dataPlaneAuthOptions' are defined. + :paramtype disable_local_auth: bool + :keyword auth_options: Defines the options for how the data plane API of a search service + authenticates requests. This cannot be set if 'disableLocalAuth' is set to true. + :paramtype auth_options: ~azure.mgmt.search.models.DataPlaneAuthOptions """ - super().__init__(location=location, tags=tags, identity=identity, **kwargs) + super().__init__(**kwargs) self.sku = sku + self.location = location + self.tags = tags + self.identity = identity self.replica_count = replica_count self.partition_count = partition_count self.hosting_mode = hosting_mode @@ -941,42 +1341,233 @@ def __init__( self.status_details = None self.provisioning_state = None self.network_rule_set = network_rule_set + self.disable_local_auth = disable_local_auth + self.auth_options = auth_options self.private_endpoint_connections = None + self.shared_private_link_resources = None -class SearchServiceListResult(_serialization.Model): - """Response containing a list of Azure Cognitive Search services. +class ShareablePrivateLinkResourceProperties(_serialization.Model): + """Describes the properties of a resource type that has been onboarded to private link service, supported by Azure Cognitive Search. Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: The list of Search services. - :vartype value: list[~azure.mgmt.search.models.SearchService] - :ivar next_link: Request URL that can be used to query next page of search services. Returned - when the total number of requested search services exceed maximum page size. + :ivar type: The resource provider type for the resource that has been onboarded to private link + service, supported by Azure Cognitive 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. + :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. + :vartype description: str + """ + + _validation = { + "type": {"readonly": True}, + "group_id": {"readonly": True}, + "description": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.type = None + self.group_id = None + self.description = None + + +class ShareablePrivateLinkResourceType(_serialization.Model): + """Describes an resource type that has been onboarded to private link service, supported by Azure Cognitive 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. + :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. + :vartype properties: ~azure.mgmt.search.models.ShareablePrivateLinkResourceProperties + """ + + _validation = { + "name": {"readonly": True}, + "properties": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "ShareablePrivateLinkResourceProperties"}, + } + + def __init__(self, **kwargs): + """ """ + super().__init__(**kwargs) + self.name = None + self.properties = None + + +class SharedPrivateLinkResource(Resource): + """Describes a Shared Private Link Resource managed by the Azure Cognitive Search service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar properties: Describes the properties of a Shared Private Link Resource managed by the + Azure Cognitive Search service. + :vartype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "SharedPrivateLinkResourceProperties"}, + } + + def __init__(self, *, properties: Optional["_models.SharedPrivateLinkResourceProperties"] = None, **kwargs): + """ + :keyword properties: Describes the properties of a Shared Private Link Resource managed by the + Azure Cognitive Search service. + :paramtype properties: ~azure.mgmt.search.models.SharedPrivateLinkResourceProperties + """ + super().__init__(**kwargs) + self.properties = properties + + +class SharedPrivateLinkResourceListResult(_serialization.Model): + """Response containing a list of Shared Private Link Resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The list of Shared Private Link Resources. + :vartype value: list[~azure.mgmt.search.models.SharedPrivateLinkResource] + :ivar next_link: The URL to get the next set of shared private link resources, if there are + any. :vartype next_link: str """ _validation = { "value": {"readonly": True}, - "next_link": {"readonly": True}, } _attribute_map = { - "value": {"key": "value", "type": "[SearchService]"}, + "value": {"key": "value", "type": "[SharedPrivateLinkResource]"}, "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): - """ """ + def __init__(self, *, next_link: Optional[str] = None, **kwargs): + """ + :keyword next_link: The URL to get the next set of shared private link resources, if there are + any. + :paramtype next_link: str + """ super().__init__(**kwargs) self.value = None - self.next_link = None + self.next_link = next_link + + +class SharedPrivateLinkResourceProperties(_serialization.Model): + """Describes the properties of an existing Shared Private Link Resource managed by the Azure Cognitive Search service. + + :ivar private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :vartype private_link_resource_id: str + :ivar group_id: The group id from the provider of resource the shared private link resource is + for. + :vartype group_id: str + :ivar request_message: The request message for requesting approval of the shared private link + resource. + :vartype request_message: str + :ivar resource_region: Optional. Can be used to specify the Azure Resource Manager location of + the resource 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". + :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". + :vartype provisioning_state: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState + """ + + _attribute_map = { + "private_link_resource_id": {"key": "privateLinkResourceId", "type": "str"}, + "group_id": {"key": "groupId", "type": "str"}, + "request_message": {"key": "requestMessage", "type": "str"}, + "resource_region": {"key": "resourceRegion", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + private_link_resource_id: Optional[str] = None, + group_id: Optional[str] = None, + request_message: Optional[str] = None, + resource_region: Optional[str] = None, + status: Optional[Union[str, "_models.SharedPrivateLinkResourceStatus"]] = None, + provisioning_state: Optional[Union[str, "_models.SharedPrivateLinkResourceProvisioningState"]] = None, + **kwargs + ): + """ + :keyword private_link_resource_id: The resource id of the resource the shared private link + resource is for. + :paramtype private_link_resource_id: str + :keyword group_id: The group id from the provider of resource the shared private link resource + is for. + :paramtype group_id: str + :keyword request_message: The request message for requesting approval of the shared private + link resource. + :paramtype request_message: str + :keyword resource_region: Optional. Can be used to specify the Azure Resource Manager location + of the resource 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". + :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". + :paramtype provisioning_state: str or + ~azure.mgmt.search.models.SharedPrivateLinkResourceProvisioningState + """ + super().__init__(**kwargs) + self.private_link_resource_id = private_link_resource_id + self.group_id = group_id + self.request_message = request_message + self.resource_region = resource_region + self.status = status + self.provisioning_state = provisioning_state class Sku(_serialization.Model): """Defines the SKU of an Azure Cognitive Search Service, which determines price tier and capacity limits. - :ivar name: The SKU of the Search service. Valid values include: 'free': Shared service. + :ivar name: The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or @@ -994,7 +1585,7 @@ class Sku(_serialization.Model): def __init__(self, *, name: Optional[Union[str, "_models.SkuName"]] = None, **kwargs): """ - :keyword name: The SKU of the Search service. Valid values include: 'free': Shared service. + :keyword name: The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or 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 04376879c857..ca79004a3a2f 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 @@ -10,10 +10,25 @@ from azure.core import CaseInsensitiveEnumMeta +class AadAuthFailureMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Describes what response the data plane API of a Search service would send for requests that + failed authentication. + """ + + #: Indicates that requests that failed authentication should be presented with an HTTP status code + #: of 403 (Forbidden). + HTTP403 = "http403" + #: Indicates that requests that failed authentication should be presented with an HTTP status code + #: of 401 (Unauthorized) and present a Bearer Challenge. + HTTP401_WITH_BEARER_CHALLENGE = "http401WithBearerChallenge" + + class AdminKeyKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """AdminKeyKind.""" + #: The primary API key for the search service. PRIMARY = "primary" + #: The secondary API key for the search service. SECONDARY = "secondary" @@ -24,7 +39,9 @@ class HostingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): all other SKUs, this value must be 'default'. """ + #: The limit on number of indexes is determined by the default limits for the SKU. DEFAULT = "default" + #: Only application for standard3 SKU, where the search service can have up to 1000 indexes. HIGH_DENSITY = "highDensity" @@ -35,29 +52,57 @@ class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): SYSTEM_ASSIGNED = "SystemAssigned" +class PrivateLinkServiceConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the private link service connection. Can be Updating, Deleting, + Failed, Succeeded, or Incomplete. + """ + + #: The private link service connection is in the process of being created along with other + #: resources for it to be fully functional. + UPDATING = "Updating" + #: The private link service connection is in the process of being deleted. + DELETING = "Deleting" + #: The private link service connection has failed to be provisioned or deleted. + FAILED = "Failed" + #: The private link service connection has finished provisioning and is ready for approval. + SUCCEEDED = "Succeeded" + #: Provisioning request for the private link service connection resource has been accepted but the + #: process of creation has not commenced yet. + INCOMPLETE = "Incomplete" + #: Provisioning request for the private link service connection resource has been canceled + CANCELED = "Canceled" + + class PrivateLinkServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of the the private link service connection. Can be Pending, Approved, Rejected, or Disconnected. """ + #: The private endpoint connection has been created and is pending approval. PENDING = "Pending" + #: The private endpoint connection is approved and is ready for use. APPROVED = "Approved" + #: The private endpoint connection has been rejected and cannot be used. REJECTED = "Rejected" + #: The private endpoint connection has been removed from the service. DISCONNECTED = "Disconnected" class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the last provisioning operation performed on the Search service. Provisioning is + """The state of the last provisioning operation performed on the search service. Provisioning is an intermediate state that occurs while service capacity is being established. After capacity is set up, provisioningState changes to either 'succeeded' or 'failed'. Client applications can poll provisioning status (the recommended polling interval is from 30 seconds to one minute) by using the Get Search Service operation to see when an operation is completed. If you are using the free service, this value tends to come back as 'succeeded' directly in the call to Create - Search service. This is because the free service uses capacity that is already set up. + search service. This is because the free service uses capacity that is already set up. """ + #: The last provisioning operation has completed successfully. SUCCEEDED = "succeeded" + #: The search service is being provisioned or scaled up or down. PROVISIONING = "provisioning" + #: The last provisioning operation has failed. FAILED = "failed" @@ -72,28 +117,66 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): 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 - being provisioned or scaled up or down. 'deleting': The Search service is being deleted. - 'degraded': The Search service is degraded. This can occur when the underlying search units are - not healthy. The Search service is most likely operational, but performance might be slow and - some requests might be dropped. 'disabled': The Search service is disabled. In this state, the - service will reject all API requests. 'error': The Search service is in an error state. If your + """The status of the search service. Possible values include: 'running': The search service is + running and no provisioning operations are underway. 'provisioning': The search service is + being provisioned or scaled up or down. 'deleting': The search service is being deleted. + 'degraded': The search service is degraded. This can occur when the underlying search units are + not healthy. The search service is most likely operational, but performance might be slow and + some requests might be dropped. 'disabled': The search service is disabled. In this state, the + service will reject all API requests. 'error': The search service is in an error state. 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. """ + #: The search service is running and no provisioning operations are underway. RUNNING = "running" + #: The search service is being provisioned or scaled up or down. PROVISIONING = "provisioning" + #: The search service is being deleted. DELETING = "deleting" + #: The search service is degraded because underlying search units are not healthy. DEGRADED = "degraded" + #: The search service is disabled and all API requests will be rejected. DISABLED = "disabled" + #: The search service is in error state, indicating either a failure to provision or to be + #: deleted. ERROR = "error" + #: The search service is in a subscription that's disabled. + STOPPED = "stopped" + + +class SharedPrivateLinkResourceAsyncOperationResult(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current status of the long running asynchronous shared private link resource operation.""" + + RUNNING = "Running" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + + +class SharedPrivateLinkResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of the shared private link resource. Can be Updating, Deleting, Failed, + Succeeded or Incomplete. + """ + + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + INCOMPLETE = "Incomplete" + + +class SharedPrivateLinkResourceStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected.""" + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The SKU of the Search service. Valid values include: 'free': Shared service. 'basic': Dedicated + """The SKU of the search service. Valid values include: 'free': Shared service. 'basic': Dedicated service with up to 3 replicas. 'standard': Dedicated service with up to 12 partitions and 12 replicas. 'standard2': Similar to standard, but with more capacity per search unit. 'standard3': The largest Standard offering with up to 12 partitions and 12 replicas (or up to 3 @@ -102,12 +185,20 @@ class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): 'storage_optimized_l2': Supports 2TB per partition, up to 12 partitions.'. """ + #: Free tier, with no SLA guarantees and a subset of features offered to paid tiers. FREE = "free" + #: Paid tier dedicated service with up to 3 replicas. BASIC = "basic" + #: Paid tier dedicated service with up to 12 partitions and 12 replicas. STANDARD = "standard" + #: Similar to 'standard', but with more capacity per search unit. STANDARD2 = "standard2" + #: 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'). STANDARD3 = "standard3" + #: Paid tier dedicated service that supports 1TB per partition, up to 12 partitions. STORAGE_OPTIMIZED_L1 = "storage_optimized_l1" + #: Paid tier dedicated service that supports 2TB per partition, up to 12 partitions. STORAGE_OPTIMIZED_L2 = "storage_optimized_l2" @@ -117,5 +208,7 @@ class UnavailableNameReason(str, Enum, metaclass=CaseInsensitiveEnumMeta): indicates that the name is already in use and is therefore unavailable. """ + #: The search service name does not match naming requirements. INVALID = "Invalid" + #: The search service name is already assigned to a different search service. ALREADY_EXISTS = "AlreadyExists" 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 5f7e85a6a72d..b7967f39c207 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 @@ -12,9 +12,10 @@ from ._services_operations import ServicesOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._shared_private_link_resources_operations import SharedPrivateLinkResourcesOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -24,6 +25,7 @@ "ServicesOperations", "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", + "SharedPrivateLinkResourcesOperations", ] __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 43f46bede499..3af98f16d85a 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 @@ -50,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -89,7 +89,7 @@ def build_regenerate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,7 +104,7 @@ def build_regenerate_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,10 +171,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdminKeyResult] + ) + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -191,9 +191,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,7 +210,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listAdminKeys" + } @distributed_trace def regenerate( @@ -252,10 +254,10 @@ def regenerate( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AdminKeyResult] + ) + cls: ClsType[_models.AdminKeyResult] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -273,9 +275,9 @@ def regenerate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -292,4 +294,6 @@ def regenerate( return deserialized - regenerate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}"} # type: ignore + regenerate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/regenerateAdminKey/{keyKind}" + } 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 69e99087abf3..0db127672e2a 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 @@ -45,7 +45,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 = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +91,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + ) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +114,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -130,7 +130,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -138,13 +138,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -157,4 +157,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Search/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Search/operations"} 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 dfef57105145..b935d3cc8fad 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 @@ -53,8 +53,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -71,7 +71,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,7 +98,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -140,7 +140,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -157,7 +157,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +181,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 = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -195,7 +195,7 @@ def build_list_by_service_request( "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,7 +239,7 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :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. @@ -277,7 +277,7 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :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. @@ -313,7 +313,7 @@ def update( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Updates a Private Endpoint connection to the Search service in the given resource group. + """Updates a Private Endpoint connection to the search service in the given resource group. :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. @@ -349,11 +349,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -381,9 +381,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -400,7 +400,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def get( @@ -411,7 +413,7 @@ def get( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Gets the details of the private endpoint connection to the Search service in the given resource + """Gets the details of the private endpoint connection to the search service in the given resource group. :param resource_group_name: The name of the resource group within the current subscription. You @@ -442,10 +444,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + ) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -463,9 +465,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -482,7 +484,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def delete( @@ -493,7 +497,7 @@ def delete( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> Optional[_models.PrivateEndpointConnection]: - """Disconnects the private endpoint connection and deletes it from the Search service. + """Disconnects the private endpoint connection and deletes it from the search service. :param resource_group_name: The name of the resource group within the current subscription. You can obtain this value from the Azure Resource Manager API or the portal. Required. @@ -523,10 +527,10 @@ def delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + ) + cls: ClsType[Optional[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -544,9 +548,9 @@ def delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -565,7 +569,9 @@ def delete( return deserialized - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def list_by_service( @@ -595,10 +601,10 @@ def list_by_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + ) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -625,7 +631,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -641,7 +647,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -649,13 +655,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -668,4 +674,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections"} # type: ignore + list_by_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateEndpointConnections" + } 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 3aeeb5b2f59d..ab8eaeaa4281 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 @@ -52,7 +52,7 @@ def build_list_supported_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +66,7 @@ def build_list_supported_request( "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,10 +125,10 @@ def list_supported( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourcesResult] + ) + cls: ClsType[_models.PrivateLinkResourcesResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -155,7 +155,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -171,7 +171,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -179,13 +179,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourcesResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -198,4 +198,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_supported.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources"} # type: ignore + list_supported.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/privateLinkResources" + } 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 adb8d6941283..cf19c6af0e6f 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 @@ -53,7 +53,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +68,7 @@ def build_create_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,7 +92,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 = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +106,7 @@ def build_list_by_search_service_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +131,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +146,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -187,7 +187,7 @@ def create( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.QueryKey: - """Generates a new query key for the specified Search service. You can create up to 50 query keys + """Generates a new query key for the specified search service. You can create up to 50 query keys per service. :param resource_group_name: The name of the resource group within the current subscription. You @@ -217,10 +217,10 @@ def create( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.QueryKey] + ) + cls: ClsType[_models.QueryKey] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -238,9 +238,9 @@ def create( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -257,7 +257,9 @@ def create( return deserialized - create.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}"} # type: ignore + create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/createQueryKey/{name}" + } @distributed_trace def list_by_search_service( @@ -286,10 +288,10 @@ def list_by_search_service( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ListQueryKeysResult] + ) + cls: ClsType[_models.ListQueryKeysResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -316,7 +318,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -332,7 +334,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -340,13 +342,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ListQueryKeysResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -359,7 +361,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_search_service.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys"} # type: ignore + list_by_search_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/listQueryKeys" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -401,10 +405,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -422,9 +426,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -437,4 +441,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/deleteQueryKey/{key}" + } 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 125e2503e14e..cc4f88938792 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 @@ -54,8 +54,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ def build_create_or_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -95,8 +95,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +110,7 @@ def build_update_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -136,7 +136,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +150,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -174,7 +174,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -188,7 +188,7 @@ def build_delete_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -207,7 +207,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 = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,7 +220,7 @@ def build_list_by_resource_group_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -239,7 +239,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 = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -248,7 +248,7 @@ def build_list_by_subscription_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -267,8 +267,8 @@ def build_check_name_availability_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2020-03-13")) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") type = "searchServices" @@ -280,7 +280,7 @@ def build_check_name_availability_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -333,11 +333,11 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -364,9 +364,9 @@ def _create_or_update_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -383,11 +383,13 @@ def _create_or_update_initial( deserialized = self._deserialize("SearchService", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @overload def begin_create_or_update( @@ -400,7 +402,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -413,7 +415,7 @@ def begin_create_or_update( 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. + :param service: The definition of the search service to create or update. Required. :type service: ~azure.mgmt.search.models.SearchService :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -446,7 +448,7 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -459,7 +461,7 @@ def begin_create_or_update( 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. + :param service: The definition of the search service to create or update. Required. :type service: IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -490,7 +492,7 @@ def begin_create_or_update( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> LROPoller[_models.SearchService]: - """Creates or updates a Search service in the given resource group. If the Search service already + """Creates or updates a search service in the given resource group. If the search service already exists, all properties will be updated with the given values. :param resource_group_name: The name of the resource group within the current subscription. You @@ -503,7 +505,7 @@ def begin_create_or_update( 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 + :param service: The definition of the search service to create or update. Is either a model 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. @@ -528,16 +530,16 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, search_service_name=search_service_name, service=service, @@ -558,7 +560,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -570,30 +572,32 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @overload def update( self, resource_group_name: str, search_service_name: str, - service: _models.SearchService, + service: _models.SearchServiceUpdate, search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, *, content_type: str = "application/json", **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :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. :type search_service_name: str - :param service: The definition of the Search service to update. Required. - :type service: ~azure.mgmt.search.models.SearchService + :param service: The definition of the search service to update. Required. + :type service: ~azure.mgmt.search.models.SearchServiceUpdate :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -617,14 +621,14 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :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. :type search_service_name: str - :param service: The definition of the Search service to update. Required. + :param service: The definition of the search service to update. Required. :type service: IO :param search_management_request_options: Parameter group. Default value is None. :type search_management_request_options: @@ -643,20 +647,20 @@ def update( self, resource_group_name: str, search_service_name: str, - service: Union[_models.SearchService, IO], + service: Union[_models.SearchServiceUpdate, IO], search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.SearchService: - """Updates an existing Search service in the given resource group. + """Updates an existing search service in the given resource group. :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. :type search_service_name: str - :param service: The definition of the Search service to update. Is either a model type or a IO + :param service: The definition of the search service to update. Is either a model type or a IO type. Required. - :type service: ~azure.mgmt.search.models.SearchService or IO + :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: ~azure.mgmt.search.models.SearchManagementRequestOptions @@ -679,11 +683,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -694,7 +698,7 @@ def update( if isinstance(service, (IO, bytes)): _content = service else: - _json = self._serialize.body(service, "SearchService") + _json = self._serialize.body(service, "SearchServiceUpdate") request = build_update_request( resource_group_name=resource_group_name, @@ -710,9 +714,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -729,7 +733,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace def get( @@ -739,7 +745,7 @@ def get( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.SearchService: - """Gets the Search service with the given name in the given resource group. + """Gets the search service with the given name in the given resource group. :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. @@ -766,10 +772,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchService] + ) + cls: ClsType[_models.SearchService] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -786,9 +792,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -805,7 +811,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -815,7 +823,7 @@ def delete( # pylint: disable=inconsistent-return-statements search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> None: - """Deletes a Search service in the given resource group, along with its associated resources. + """Deletes a search service in the given resource group, along with its associated resources. :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. @@ -842,10 +850,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + ) + cls: ClsType[None] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -862,9 +870,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -877,7 +885,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}" + } @distributed_trace def list_by_resource_group( @@ -902,10 +912,10 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchServiceListResult] + ) + cls: ClsType[_models.SearchServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -931,7 +941,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -947,7 +957,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -955,13 +965,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SearchServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -974,7 +984,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices" + } @distributed_trace def list_by_subscription( @@ -993,10 +1005,10 @@ def list_by_subscription( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.SearchServiceListResult] + ) + cls: ClsType[_models.SearchServiceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1021,7 +1033,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -1037,7 +1049,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1045,13 +1057,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("SearchServiceListResult", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + 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) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -1064,7 +1076,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/searchServices"} @distributed_trace def check_name_availability( @@ -1073,11 +1085,11 @@ def check_name_availability( search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: - """Checks whether or not the given Search service name is available for use. Search service names + """Checks whether or not the given search service name is available for use. Search service names must be globally unique since they are part of the service URI (https://:code:``.search.windows.net). - :param name: The Search service name to validate. Search service names must only contain + :param name: The search service name to validate. Search service names must only contain lowercase letters, digits or dashes, cannot use dash as the first two or last one characters, cannot contain consecutive dashes, and must be between 2 and 60 characters in length. Required. :type name: str @@ -1104,12 +1116,12 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( + api_version: Literal["2022-09-01"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2020-03-13"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) # type: str - type = kwargs.pop("type", "searchServices") # type: Literal["searchServices"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CheckNameAvailabilityOutput] + ) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + type: Literal["searchServices"] = kwargs.pop("type", "searchServices") + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) _client_request_id = None if search_management_request_options is not None: @@ -1128,9 +1140,9 @@ def check_name_availability( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -1147,4 +1159,6 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/checkNameAvailability" + } 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 new file mode 100644 index 000000000000..fd9dad1cbe97 --- /dev/null +++ b/sdk/search/azure-mgmt-search/azure/mgmt/search/operations/_shared_private_link_resources_operations.py @@ -0,0 +1,831 @@ +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + "sharedPrivateLinkResourceName": _SERIALIZER.url( + "shared_private_link_resource_name", shared_private_link_resource_name, "str" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_service_request( + resource_group_name: str, + search_service_name: str, + subscription_id: str, + *, + client_request_id: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "searchServiceName": _SERIALIZER.url("search_service_name", search_service_name, "str"), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if client_request_id is not None: + _headers["x-ms-client-request-id"] = _SERIALIZER.header("client_request_id", client_request_id, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SharedPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.search.SearchManagementClient`'s + :attr:`shared_private_link_resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = 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") + + def _create_or_update_initial( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO], + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> Optional[_models.SharedPrivateLinkResource]: + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = 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) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(shared_private_link_resource, (IO, bytes)): + _content = shared_private_link_resource + else: + _json = self._serialize.body(shared_private_link_resource, "SharedPrivateLinkResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self._create_or_update_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: _models.SharedPrivateLinkResource, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :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. + :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. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: ~azure.mgmt.search.models.SharedPrivateLinkResource + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SharedPrivateLinkResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: IO, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :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. + :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. + :type shared_private_link_resource_name: str + :param shared_private_link_resource: The definition of the shared private link resource to + create or update. Required. + :type shared_private_link_resource: IO + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SharedPrivateLinkResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + shared_private_link_resource: Union[_models.SharedPrivateLinkResource, IO], + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> LROPoller[_models.SharedPrivateLinkResource]: + """Initiates the creation or update of a shared private link resource managed by the search + service in the given resource group. + + :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. + :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. + :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. + :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: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SharedPrivateLinkResource or the result + of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + shared_private_link_resource=shared_private_link_resource, + search_management_request_options=search_management_request_options, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace + def get( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> _models.SharedPrivateLinkResource: + """Gets the details of the shared private link resource managed by the search service in the given + resource group. + + :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. + :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. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SharedPrivateLinkResource or the result of cls(response) + :rtype: ~azure.mgmt.search.models.SharedPrivateLinkResource + :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: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SharedPrivateLinkResource] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_get_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SharedPrivateLinkResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> None: + error_map = { + 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: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + _client_request_id = None + if search_management_request_options is not None: + _client_request_id = search_management_request_options.client_request_id + + request = build_delete_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self._delete_initial.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204, 404]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + search_service_name: str, + shared_private_link_resource_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> LROPoller[None]: + """Initiates the deletion of the shared private link resource from the search service. + + :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. + :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. + :type shared_private_link_resource_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + search_service_name=search_service_name, + shared_private_link_resource_name=shared_private_link_resource_name, + search_management_request_options=search_management_request_options, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + } + + @distributed_trace + def list_by_service( + self, + resource_group_name: str, + search_service_name: str, + search_management_request_options: Optional[_models.SearchManagementRequestOptions] = None, + **kwargs: Any + ) -> Iterable["_models.SharedPrivateLinkResource"]: + """Gets a list of all shared private link resources managed by the given service. + + :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. + :type search_service_name: str + :param search_management_request_options: Parameter group. Default value is None. + :type search_management_request_options: + ~azure.mgmt.search.models.SearchManagementRequestOptions + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SharedPrivateLinkResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.search.models.SharedPrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2022-09-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SharedPrivateLinkResourceListResult] = 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_service_request( + resource_group_name=resource_group_name, + search_service_name=search_service_name, + subscription_id=self._config.subscription_id, + client_request_id=_client_request_id, + api_version=api_version, + template_url=self.list_by_service.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("SharedPrivateLinkResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=False, **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_service.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Search/searchServices/{searchServiceName}/sharedPrivateLinkResources" + } 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 new file mode 100644 index 000000000000..f84dbc7b23c6 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/create_or_update_shared_private_link_resource.py @@ -0,0 +1,50 @@ +# 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 create_or_update_shared_private_link_resource.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.shared_private_link_resources.begin_create_or_update( + resource_group_name="rg1", + search_service_name="mysearchservice", + shared_private_link_resource_name="testResource", + shared_private_link_resource={ + "properties": { + "groupId": "blob", + "privateLinkResourceId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Storage/storageAccounts/storageAccountName", + "requestMessage": "please approve", + "resourceRegion": None, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/CreateOrUpdateSharedPrivateLinkResource.json +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_delete.py b/sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py similarity index 93% rename from sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_delete.py rename to sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py index 2e5a63e93736..1703b4283f9c 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/search/azure-mgmt-search/generated_samples/delete_private_endpoint_connection.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-search # USAGE - python private_endpoint_connection_delete.py + python delete_private_endpoint_connection.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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/DeletePrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 new file mode 100644 index 000000000000..eb4c99f14469 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/delete_shared_private_link_resource.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 delete_shared_private_link_resource.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.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 +if __name__ == "__main__": + main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_get.py b/sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py similarity index 93% rename from sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_get.py rename to sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py index 25e9c1fff266..00905fc23153 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_get.py +++ b/sdk/search/azure-mgmt-search/generated_samples/get_private_endpoint_connection.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-search # USAGE - python private_endpoint_connection_get.py + python get_private_endpoint_connection.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, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/GetPrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/GetPrivateEndpointConnection.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 new file mode 100644 index 000000000000..f9fb209d9292 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/get_shared_private_link_resource.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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_shared_private_link_resource.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.shared_private_link_resources.get( + resource_group_name="rg1", + search_service_name="mysearchservice", + shared_private_link_resource_name="testResource", + ) + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 89bd5757c693..f0a40c5bfba7 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/2020-03-13/examples/ListPrivateEndpointConnectionsByService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 new file mode 100644 index 000000000000..3d5cb425a597 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/list_shared_private_link_resources_by_service.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 list_shared_private_link_resources_by_service.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="subid", + ) + + response = client.shared_private_link_resources.list_by_service( + resource_group_name="rg1", + search_service_name="mysearchservice", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 f5691abeab66..1d0025e3a9de 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/2020-03-13/examples/ListSupportedPrivateLinkResources.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 new file mode 100644 index 000000000000..824242e1cfc3 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/operations_list.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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 operations_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = SearchManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 693960b392f7..e3599986c349 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/2020-03-13/examples/SearchCreateOrUpdateService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 new file mode 100644 index 000000000000..0862edaca7d8 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_auth_options.py @@ -0,0 +1,52 @@ +# 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_service_auth_options.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": { + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "http401WithBearerChallenge"}}, + "hostingMode": "default", + "partitionCount": 1, + "replicaCount": 3, + }, + "sku": {"name": "standard"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 new file mode 100644 index 000000000000..d00cee29931b --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_create_or_update_service_disable_local_auth.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_service_disable_local_auth.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": {"disableLocalAuth": True, "hostingMode": "default", "partitionCount": 1, "replicaCount": 3}, + "sku": {"name": "standard"}, + "tags": {"app-name": "My e-commerce app"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 074757155549..2f9941264396 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/2020-03-13/examples/SearchCreateOrUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 c08b62a777c8..ca81bd351079 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/2020-03-13/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceToAllowAccessFromPublicCustomIPs.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 103769ca3be6..b3fb30cf4fec 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/2020-03-13/examples/SearchCreateOrUpdateServiceWithIdentity.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchCreateOrUpdateServiceWithIdentity.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 5dad25522897..69beedfff28a 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/2020-03-13/examples/SearchCreateQueryKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 1f51486b1d7d..73fe4287a18c 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_delete_query_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchDeleteQueryKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 343b89671b29..0dcfa2cbe1d6 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py +++ b/sdk/search/azure-mgmt-search/generated_samples/search_delete_service.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/SearchDeleteService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 b91263f10e89..7db1238bd873 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/2020-03-13/examples/SearchGetAdminKeys.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 8ed7b40f1540..09df6af3aa06 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/2020-03-13/examples/SearchGetService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 6ce8f5d03d26..fc8f51bc709c 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/2020-03-13/examples/SearchListQueryKeysBySearchService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 e45b9720d44c..0ada50f806a2 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/2020-03-13/examples/SearchListServicesByResourceGroup.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 e1a0d430434a..d9b85d8beb45 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/2020-03-13/examples/SearchListServicesBySubscription.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 c5a2a7906d7c..0f33a958c13f 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/2020-03-13/examples/SearchRegenerateAdminKey.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 35d0f3c567c1..6e377951241c 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/2020-03-13/examples/SearchUpdateService.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 new file mode 100644 index 000000000000..cefac91e76d2 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_auth_options.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) 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_auth_options.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": { + "authOptions": {"aadOrApiKey": {"aadAuthFailureMode": "http401WithBearerChallenge"}}, + "replicaCount": 2, + }, + "tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 new file mode 100644 index 000000000000..880e0e707bf4 --- /dev/null +++ b/sdk/search/azure-mgmt-search/generated_samples/search_update_service_disable_local_auth.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_disable_local_auth.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": {"disableLocalAuth": True, "replicaCount": 2}, + "tags": {"app-name": "My e-commerce app", "new-tag": "Adding a new tag"}, + }, + ) + print(response) + + +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 2f7dcfdc104a..1d095150ca08 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/2020-03-13/examples/SearchUpdateServiceToAllowAccessFromPrivateEndpoints.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 05b981e33de5..a1c03d02847b 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/2020-03-13/examples/SearchUpdateServiceToAllowAccessFromPublicCustomIPs.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-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 5bdd1dacdc0c..2547cdd49c40 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/2020-03-13/examples/SearchUpdateServiceToRemoveIdentity.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/SearchUpdateServiceToRemoveIdentity.json if __name__ == "__main__": main() diff --git a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_update.py b/sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py similarity index 93% rename from sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_update.py rename to sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py index bb7fbebd1af9..44510934209a 100644 --- a/sdk/search/azure-mgmt-search/generated_samples/private_endpoint_connection_update.py +++ b/sdk/search/azure-mgmt-search/generated_samples/update_private_endpoint_connection.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-search # USAGE - python private_endpoint_connection_update.py + python update_private_endpoint_connection.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, @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2020-03-13/examples/UpdatePrivateEndpointConnection.json +# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2022-09-01/examples/UpdatePrivateEndpointConnection.json if __name__ == "__main__": main()