From 2a3273897261d97d87e67c7924c83a2a3b63a48c Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 28 Apr 2023 17:17:34 +0000 Subject: [PATCH] CodeGen from PR 23726 in Azure/azure-rest-api-specs Merge 3255cf33cf40c5e01bbb00b8d92e5ce386db228b into 47e16c37d55bd8388b68d2703a52c4b15b8c9024 --- sdk/redis/azure-mgmt-redis/_meta.json | 6 +- .../azure/mgmt/redis/__init__.py | 2 +- .../azure/mgmt/redis/_configuration.py | 15 +- .../mgmt/redis/_redis_management_client.py | 17 +- .../azure/mgmt/redis/_serialization.py | 180 ++++--- .../azure/mgmt/redis/_vendor.py | 5 +- .../azure/mgmt/redis/_version.py | 2 +- .../azure/mgmt/redis/aio/__init__.py | 2 +- .../azure/mgmt/redis/aio/_configuration.py | 10 +- .../redis/aio/_redis_management_client.py | 10 +- .../mgmt/redis/aio/operations/__init__.py | 2 +- .../_async_operation_status_operations.py | 22 +- .../operations/_firewall_rules_operations.py | 85 ++-- .../operations/_linked_server_operations.py | 127 +++-- .../mgmt/redis/aio/operations/_operations.py | 24 +- .../operations/_patch_schedules_operations.py | 87 ++-- ...private_endpoint_connections_operations.py | 109 +++-- .../_private_link_resources_operations.py | 26 +- .../redis/aio/operations/_redis_operations.py | 388 +++++++-------- .../azure/mgmt/redis/models/__init__.py | 2 +- .../azure/mgmt/redis/models/_models_py3.py | 211 ++++---- .../azure/mgmt/redis/operations/__init__.py | 2 +- .../_async_operation_status_operations.py | 26 +- .../operations/_firewall_rules_operations.py | 103 ++-- .../operations/_linked_server_operations.py | 145 +++--- .../mgmt/redis/operations/_operations.py | 26 +- .../operations/_patch_schedules_operations.py | 105 ++-- ...private_endpoint_connections_operations.py | 127 +++-- .../_private_link_resources_operations.py | 30 +- .../redis/operations/_redis_operations.py | 454 +++++++++--------- .../redis_cache_async_operation_status.py | 2 +- .../redis_cache_check_name_availability.py | 2 +- .../generated_samples/redis_cache_create.py | 2 +- .../redis_cache_create_default_version.py | 2 +- .../redis_cache_create_latest_version.py | 2 +- .../generated_samples/redis_cache_delete.py | 2 +- ...ache_delete_private_endpoint_connection.py | 2 +- .../generated_samples/redis_cache_export.py | 3 +- .../redis_cache_firewall_rule_create.py | 2 +- .../redis_cache_firewall_rule_delete.py | 2 +- .../redis_cache_firewall_rule_get.py | 2 +- .../redis_cache_firewall_rules_list.py | 2 +- .../redis_cache_force_reboot.py | 2 +- .../generated_samples/redis_cache_get.py | 2 +- ...s_cache_get_private_endpoint_connection.py | 2 +- .../generated_samples/redis_cache_import.py | 8 +- ...py => redis_cache_linked_server_create.py} | 4 +- ...py => redis_cache_linked_server_delete.py} | 4 +- ...et.py => redis_cache_linked_server_get.py} | 4 +- ...t.py => redis_cache_linked_server_list.py} | 4 +- .../generated_samples/redis_cache_list.py | 2 +- .../redis_cache_list_by_resource_group.py | 2 +- .../redis_cache_list_keys.py | 2 +- ...ache_list_private_endpoint_connections.py} | 4 +- ...edis_cache_list_private_link_resources.py} | 4 +- .../redis_cache_list_upgrade_notifications.py | 2 +- .../redis_cache_operations.py | 2 +- ..._cache_patch_schedules_create_or_update.py | 2 +- .../redis_cache_patch_schedules_delete.py | 2 +- .../redis_cache_patch_schedules_get.py | 2 +- .../redis_cache_patch_schedules_list.py | 2 +- ...s_cache_put_private_endpoint_connection.py | 2 +- .../redis_cache_regenerate_key.py | 2 +- .../generated_samples/redis_cache_update.py | 2 +- 64 files changed, 1237 insertions(+), 1200 deletions(-) rename sdk/redis/azure-mgmt-redis/generated_samples/{linked_server_create.py => redis_cache_linked_server_create.py} (94%) rename sdk/redis/azure-mgmt-redis/generated_samples/{linked_server_delete.py => redis_cache_linked_server_delete.py} (92%) rename sdk/redis/azure-mgmt-redis/generated_samples/{linked_server_get.py => redis_cache_linked_server_get.py} (93%) rename sdk/redis/azure-mgmt-redis/generated_samples/{linked_server_list.py => redis_cache_linked_server_list.py} (92%) rename sdk/redis/azure-mgmt-redis/generated_samples/{redis_cache_list_private_endpoint_connection.py => redis_cache_list_private_endpoint_connections.py} (92%) rename sdk/redis/azure-mgmt-redis/generated_samples/{storage_account_list_private_link_resources.py => redis_cache_list_private_link_resources.py} (92%) diff --git a/sdk/redis/azure-mgmt-redis/_meta.json b/sdk/redis/azure-mgmt-redis/_meta.json index fd166e88dea7..76f1da5c522d 100644 --- a/sdk/redis/azure-mgmt-redis/_meta.json +++ b/sdk/redis/azure-mgmt-redis/_meta.json @@ -1,11 +1,11 @@ { - "commit": "21426cf85836ec17aaa4f20f58324a8666925e34", + "commit": "e19afe148e3c5a08ad6202436ab3d64c0e18cfe1", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.1", + "@autorest/python@6.4.8", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/redis/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.1 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/redis/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.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/redis/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py index dfcf2b7ee784..1f4eb2b9c1d1 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/__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/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py index acc993e2adff..ad5e1f2b8823 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from ._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -36,14 +30,14 @@ class RedisManagementClientConfiguration(Configuration): # pylint: disable=too- :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-04-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(RedisManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-06-01") # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", "2023-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -57,10 +51,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-redis/{}".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/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_management_client.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_management_client.py index bab1a4e0cba6..1f7324775c71 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_management_client.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_redis_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 RedisManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -58,7 +58,7 @@ class RedisManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-04-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 @@ -75,9 +75,9 @@ def __init__( self._config = RedisManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + 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 @@ -118,15 +118,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: () -> RedisManagementClient + def __enter__(self) -> "RedisManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_serialization.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_serialization.py index 7c1dedb5133d..842ae727fbbc 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_serialization.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,23 +38,38 @@ import re import sys import codecs +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + 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 - -from typing import Dict, Any, cast, TYPE_CHECKING +import isodate # type: ignore from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] class RawDeserializer: @@ -65,8 +81,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 +147,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 +174,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 +202,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 +233,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,12 +290,12 @@ 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 = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -290,27 +304,27 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,13 +333,13 @@ 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 = {} return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -339,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -387,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -399,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -412,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -453,7 +477,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.", @@ -521,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -537,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -605,14 +629,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_desc.get("attr", False): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) - xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) + 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 +645,22 @@ 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): - unflattened = {k: new_attr} - new_attr = unflattened + for k in reversed(keys): # type: ignore + new_attr = {k: new_attr} _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 @@ -659,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -675,7 +698,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: @@ -780,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -843,7 +868,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 +1026,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}" @@ -1164,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1245,7 +1271,7 @@ def _extract_name_from_internal_type(internal_type): xml_name = internal_type_xml_map.get("name", internal_type.__name__) xml_ns = internal_type_xml_map.get("ns", None) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) return xml_name @@ -1269,7 +1295,7 @@ def xml_key_extractor(attr, attr_desc, data): # Integrate namespace if necessary xml_ns = xml_desc.get("ns", internal_type_xml_map.get("ns", None)) if xml_ns: - xml_name = "{}{}".format(xml_ns, xml_name) + xml_name = "{{{}}}{}".format(xml_ns, xml_name) # If it's an attribute, that's simple if xml_desc.get("attr", False): @@ -1335,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1355,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1416,7 +1442,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 +1470,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) @@ -1474,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1489,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1499,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: @@ -1543,7 +1569,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 +1591,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 +1773,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 +1824,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 +1836,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 +1852,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 +1867,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 +1897,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 +1912,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 +1927,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 +1950,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 +1986,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/redis/azure-mgmt-redis/azure/mgmt/redis/_vendor.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_vendor.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py index b96ff9ffe2bc..dc6920075e88 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "14.1.0" +VERSION = "12.0.0b1" diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/__init__.py index d1494a148b90..a416b81a147b 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/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/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_configuration.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_configuration.py index 96a3cba1c0ed..692af2a8ae5e 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_configuration.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_configuration.py @@ -6,7 +6,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -15,11 +14,6 @@ from .._version import VERSION -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -36,14 +30,14 @@ class RedisManagementClientConfiguration(Configuration): # pylint: disable=too- :param subscription_id: Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-04-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(RedisManagementClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-06-01") # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", "2023-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_management_client.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_management_client.py index ccf45e8d1360..6176a6560bb7 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_management_client.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/_redis_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 RedisManagementClientConfiguration from .operations import ( @@ -58,7 +58,7 @@ class RedisManagementClient: # pylint: disable=client-accepts-api-version-keywo :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2023-04-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 @@ -75,9 +75,9 @@ def __init__( self._config = RedisManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + 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 @@ -125,5 +125,5 @@ async def __aenter__(self) -> "RedisManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py index beea845aa5be..8237f395ab5c 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/__init__.py @@ -16,7 +16,7 @@ from ._async_operation_status_operations import AsyncOperationStatusOperations 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__ = [ diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_async_operation_status_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_async_operation_status_operations.py index d29086b17b21..dfbee64de9fc 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_async_operation_status_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_async_operation_status_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ from ..._vendor import _convert_request from ...operations._async_operation_status_operations import build_get_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]] @@ -79,10 +74,8 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( location=location, @@ -94,10 +87,11 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -114,4 +108,6 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py index 579276fbc421..01d9c591d2a2 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_firewall_rules_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +35,6 @@ build_list_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]] @@ -81,10 +76,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisFirewallRuleListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisFirewallRuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +100,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 @@ -123,7 +116,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 @@ -131,14 +124,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RedisFirewallRuleListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,7 +145,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules" + } @overload async def create_or_update( @@ -233,7 +229,7 @@ async def create_or_update( :param rule_name: The name of the firewall rule. Required. :type rule_name: str :param parameters: Parameters supplied to the create or update redis firewall rule operation. - Is either a model type or a IO type. Required. + Is either a RedisFirewallRule type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisFirewallRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -254,11 +250,9 @@ async def 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisFirewallRule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisFirewallRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -282,10 +276,11 @@ async def create_or_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -302,11 +297,13 @@ async def create_or_update( deserialized = self._deserialize("RedisFirewallRule", 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.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" + } @distributed_trace_async async def get( @@ -336,10 +333,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisFirewallRule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisFirewallRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -352,10 +347,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -372,7 +368,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -402,10 +400,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -418,10 +414,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -434,4 +431,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.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_linked_server_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_linked_server_operations.py index e4f759e71cbe..d263dcdb1178 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_linked_server_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_linked_server_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +37,6 @@ build_list_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]] @@ -84,11 +79,9 @@ async def _create_initial( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisLinkedServerWithProperties] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisLinkedServerWithProperties] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -112,10 +105,11 @@ async def _create_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -132,11 +126,13 @@ async def _create_initial( deserialized = self._deserialize("RedisLinkedServerWithProperties", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } @overload async def begin_create( @@ -236,8 +232,8 @@ async def begin_create( :param linked_server_name: The name of the linked server that is being added to the Redis cache. Required. :type linked_server_name: str - :param parameters: Parameters supplied to the Create Linked server operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters supplied to the Create Linked server operation. Is either a + RedisLinkedServerCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisLinkedServerCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -259,16 +255,14 @@ async def begin_create( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisLinkedServerWithProperties] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisLinkedServerWithProperties] = 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_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, @@ -289,7 +283,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: @@ -301,9 +295,11 @@ 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.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, linked_server_name: str, **kwargs: Any @@ -319,10 +315,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -335,10 +329,11 @@ async def _delete_initial( # 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,7 +346,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } @distributed_trace_async async def begin_delete( @@ -381,13 +378,11 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = 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._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -406,7 +401,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -418,9 +413,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } @distributed_trace_async async def get( @@ -450,10 +447,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisLinkedServerWithProperties] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisLinkedServerWithProperties] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -466,10 +461,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -486,7 +482,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } @distributed_trace def list( @@ -508,10 +506,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisLinkedServerWithPropertiesList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisLinkedServerWithPropertiesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -534,7 +530,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 @@ -550,7 +546,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 @@ -558,14 +554,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RedisLinkedServerWithPropertiesList", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -578,4 +575,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_operations.py index 16ab94ad9d05..b8038240a005 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_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]] @@ -69,10 +64,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -92,7 +85,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 +101,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,14 +109,15 @@ 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 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,4 +130,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Cache/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cache/operations"} diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch_schedules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch_schedules_operations.py index 3288fd9d9b71..5d9579127239 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch_schedules_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_patch_schedules_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -36,10 +35,6 @@ build_list_by_redis_resource_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]] @@ -81,10 +76,8 @@ def list_by_redis_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisPatchScheduleListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisPatchScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -107,7 +100,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 @@ -123,7 +116,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 @@ -131,14 +124,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RedisPatchScheduleListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,7 +145,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_redis_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules"} # type: ignore + list_by_redis_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules" + } @overload async def create_or_update( @@ -233,8 +229,8 @@ async def create_or_update( :param default: Default string modeled as parameter for auto generation to work correctly. "default" Required. :type default: str or ~azure.mgmt.redis.models.DefaultName - :param parameters: Parameters to set the patching schedule for Redis cache. Is either a model - type or a IO type. Required. + :param parameters: Parameters to set the patching schedule for Redis cache. Is either a + RedisPatchSchedule type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisPatchSchedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -255,11 +251,9 @@ async def 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisPatchSchedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisPatchSchedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -283,10 +277,11 @@ async def create_or_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -303,11 +298,13 @@ async def create_or_update( deserialized = self._deserialize("RedisPatchSchedule", 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.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -338,10 +335,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -354,10 +349,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,7 +366,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.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" + } @distributed_trace_async async def get( @@ -401,10 +399,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisPatchSchedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisPatchSchedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -417,10 +413,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -437,4 +434,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_endpoint_connections_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_endpoint_connections_operations.py index b24a6629a3e1..4417362b1ce1 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -38,10 +37,6 @@ build_put_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]] @@ -85,10 +80,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +104,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 @@ -127,7 +120,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 @@ -135,14 +128,15 @@ 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 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -155,7 +149,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections" + } @distributed_trace_async async def get( @@ -186,10 +182,8 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,10 +196,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -222,7 +217,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _put_initial( self, @@ -243,11 +240,9 @@ async def _put_initial( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -271,10 +266,11 @@ async def _put_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -291,11 +287,13 @@ async def _put_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _put_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_put( @@ -393,8 +391,8 @@ async def begin_put( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a model type or a IO - type. Required. + :param properties: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO type. Required. :type properties: ~azure.mgmt.redis.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -415,16 +413,14 @@ async def begin_put( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + 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._put_initial( # type: ignore + raw_result = await self._put_initial( resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -445,7 +441,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: @@ -457,9 +453,11 @@ 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_put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -490,10 +488,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -506,10 +502,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -522,4 +519,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.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_link_resources_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_link_resources_operations.py index 3ff384da4a48..705f54fd2c92 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_link_resources_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_private_link_resources_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_redis_cache_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]] @@ -75,10 +70,8 @@ def list_by_redis_cache( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +94,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 @@ -117,7 +110,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 @@ -125,14 +118,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -145,4 +139,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_redis_cache.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources"} # type: ignore + list_by_redis_cache.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_redis_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_redis_operations.py index 5425c335bc93..e6835bd069a9 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_redis_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_redis_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -47,10 +46,6 @@ build_update_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]] @@ -121,8 +116,8 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem """Checks that the redis cache name is valid and is not already in use. :param parameters: Parameters supplied to the CheckNameAvailability Redis operation. The only - supported resource type is 'Microsoft.Cache/redis'. Is either a model type or a IO type. - Required. + supported resource type is 'Microsoft.Cache/redis'. Is either a CheckNameAvailabilityParameters + type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.CheckNameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -143,11 +138,9 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -168,10 +161,11 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -184,7 +178,9 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, {}) - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability" + } @distributed_trace def list_upgrade_notifications( @@ -206,10 +202,8 @@ def list_upgrade_notifications( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotificationListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -233,7 +227,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 @@ -249,7 +243,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 @@ -257,14 +251,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("NotificationListResponse", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -277,7 +272,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_upgrade_notifications.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications"} # type: ignore + list_upgrade_notifications.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications" + } async def _create_initial( self, resource_group_name: str, name: str, parameters: Union[_models.RedisCreateParameters, IO], **kwargs: Any @@ -293,11 +290,9 @@ async def _create_initial( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -320,10 +315,11 @@ async def _create_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -340,11 +336,13 @@ async def _create_initial( deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @overload async def begin_create( @@ -426,8 +424,8 @@ async def begin_create( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Parameters supplied to the Create Redis operation. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to the Create Redis operation. Is either a + RedisCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -448,16 +446,14 @@ async def begin_create( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisResource] = 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_initial( # type: ignore + raw_result = await self._create_initial( resource_group_name=resource_group_name, name=name, parameters=parameters, @@ -477,7 +473,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: @@ -489,9 +485,11 @@ 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.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } async def _update_initial( self, resource_group_name: str, name: str, parameters: Union[_models.RedisUpdateParameters, IO], **kwargs: Any @@ -507,11 +505,9 @@ async def _update_initial( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -534,10 +530,11 @@ async def _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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -554,11 +551,13 @@ async def _update_initial( deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @overload async def begin_update( @@ -640,8 +639,8 @@ async def begin_update( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Parameters supplied to the Update Redis operation. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to the Update Redis operation. Is either a + RedisUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -662,16 +661,14 @@ async def begin_update( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisResource] = 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._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, name=name, parameters=parameters, @@ -691,7 +688,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: @@ -703,9 +700,11 @@ 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_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -721,10 +720,8 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -736,10 +733,11 @@ async def _delete_initial( # 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -752,7 +750,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -777,13 +777,11 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = 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._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -801,7 +799,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -813,9 +811,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @distributed_trace_async async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.RedisResource: @@ -841,10 +841,8 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -856,10 +854,11 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -876,7 +875,9 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.RedisResource"]: @@ -892,10 +893,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -917,7 +916,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 @@ -933,7 +932,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 @@ -941,14 +940,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RedisListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -961,7 +961,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.Cache/redis"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.RedisResource"]: @@ -975,10 +977,8 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.RedisRes _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -999,7 +999,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 @@ -1015,7 +1015,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 @@ -1023,14 +1023,15 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RedisListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1043,7 +1044,7 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis"} @distributed_trace_async async def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.RedisAccessKeys: @@ -1070,10 +1071,8 @@ async def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisAccessKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisAccessKeys] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -1085,10 +1084,11 @@ async def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1105,7 +1105,9 @@ async def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys" + } @overload async def regenerate_key( @@ -1178,8 +1180,8 @@ async def regenerate_key( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Specifies which key to regenerate. Is either a model type or a IO type. - Required. + :param parameters: Specifies which key to regenerate. Is either a RedisRegenerateKeyParameters + type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisRegenerateKeyParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1200,11 +1202,9 @@ async def regenerate_key( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisAccessKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisAccessKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1227,10 +1227,11 @@ async def regenerate_key( 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1247,7 +1248,9 @@ async def regenerate_key( return deserialized - regenerate_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey"} # type: ignore + regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey" + } @overload async def force_reboot( @@ -1316,8 +1319,8 @@ async def force_reboot( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Specifies which Redis node(s) to reboot. Is either a model type or a IO - type. Required. + :param parameters: Specifies which Redis node(s) to reboot. Is either a RedisRebootParameters + type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisRebootParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1338,11 +1341,9 @@ async def force_reboot( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisForceRebootResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisForceRebootResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1365,10 +1366,11 @@ async def force_reboot( 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1385,7 +1387,9 @@ async def force_reboot( return deserialized - force_reboot.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot"} # type: ignore + force_reboot.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot" + } async def _import_data_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, parameters: Union[_models.ImportRDBParameters, IO], **kwargs: Any @@ -1401,11 +1405,9 @@ async def _import_data_initial( # pylint: disable=inconsistent-return-statement _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1428,10 +1430,11 @@ async def _import_data_initial( # pylint: disable=inconsistent-return-statement 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1444,7 +1447,9 @@ async def _import_data_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _import_data_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import"} # type: ignore + _import_data_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import" + } @overload async def begin_import_data( @@ -1524,8 +1529,8 @@ async def begin_import_data( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Parameters for Redis import operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for Redis import operation. Is either a ImportRDBParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.ImportRDBParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1545,14 +1550,12 @@ async def begin_import_data( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[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 = 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._import_data_initial( # type: ignore resource_group_name=resource_group_name, @@ -1572,7 +1575,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -1584,9 +1587,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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_import_data.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import"} # type: ignore + begin_import_data.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import" + } async def _export_data_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, parameters: Union[_models.ExportRDBParameters, IO], **kwargs: Any @@ -1602,11 +1607,9 @@ async def _export_data_initial( # pylint: disable=inconsistent-return-statement _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1629,10 +1632,11 @@ async def _export_data_initial( # pylint: disable=inconsistent-return-statement 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1645,7 +1649,9 @@ async def _export_data_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, {}) - _export_data_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export"} # type: ignore + _export_data_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export" + } @overload async def begin_export_data( @@ -1725,8 +1731,8 @@ async def begin_export_data( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Parameters for Redis export operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for Redis export operation. Is either a ExportRDBParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.ExportRDBParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1746,14 +1752,12 @@ async def begin_export_data( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[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 = 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._export_data_initial( # type: ignore resource_group_name=resource_group_name, @@ -1773,7 +1777,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -1785,6 +1789,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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_export_data.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export"} # type: ignore + begin_export_data.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py index ea0befeae6bd..6828a78bbab3 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/__init__.py @@ -73,7 +73,7 @@ from ._redis_management_client_enums import SkuName from ._redis_management_client_enums import TlsVersion 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__ = [ diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py index 5688fe8c9961..6b145d9757df 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/models/_models_py3.py @@ -39,7 +39,7 @@ class CheckNameAvailabilityParameters(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: str, type: str, **kwargs): + def __init__(self, *, name: str, type: str, **kwargs: Any) -> None: """ :keyword name: Resource name. Required. :paramtype name: str @@ -73,7 +73,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -113,7 +113,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -156,7 +156,7 @@ class ErrorDetailAutoGenerated(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -167,7 +167,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.redis.models.ErrorDetail @@ -177,7 +178,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.redis.models.ErrorDetail @@ -200,6 +201,9 @@ class ExportRDBParameters(_serialization.Model): :ivar preferred_data_archive_auth_method: Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. :vartype preferred_data_archive_auth_method: str + :ivar storage_subscription_id: Subscription id of the storage container for data to be exported + using ManagedIdentity. + :vartype storage_subscription_id: str """ _validation = { @@ -212,6 +216,7 @@ class ExportRDBParameters(_serialization.Model): "prefix": {"key": "prefix", "type": "str"}, "container": {"key": "container", "type": "str"}, "preferred_data_archive_auth_method": {"key": "preferred-data-archive-auth-method", "type": "str"}, + "storage_subscription_id": {"key": "storage-subscription-id", "type": "str"}, } def __init__( @@ -221,8 +226,9 @@ def __init__( container: str, format: Optional[str] = None, preferred_data_archive_auth_method: Optional[str] = None, - **kwargs - ): + storage_subscription_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword format: File format. :paramtype format: str @@ -233,12 +239,16 @@ def __init__( :keyword preferred_data_archive_auth_method: Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. :paramtype preferred_data_archive_auth_method: str + :keyword storage_subscription_id: Subscription id of the storage container for data to be + exported using ManagedIdentity. + :paramtype storage_subscription_id: str """ super().__init__(**kwargs) self.format = format self.prefix = prefix self.container = container self.preferred_data_archive_auth_method = preferred_data_archive_auth_method + self.storage_subscription_id = storage_subscription_id class ImportRDBParameters(_serialization.Model): @@ -253,6 +263,9 @@ class ImportRDBParameters(_serialization.Model): :ivar preferred_data_archive_auth_method: Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. :vartype preferred_data_archive_auth_method: str + :ivar storage_subscription_id: Subscription id of the storage container containing files to + import using Managed Identity. + :vartype storage_subscription_id: str """ _validation = { @@ -263,6 +276,7 @@ class ImportRDBParameters(_serialization.Model): "format": {"key": "format", "type": "str"}, "files": {"key": "files", "type": "[str]"}, "preferred_data_archive_auth_method": {"key": "preferred-data-archive-auth-method", "type": "str"}, + "storage_subscription_id": {"key": "storage-subscription-id", "type": "str"}, } def __init__( @@ -271,8 +285,9 @@ def __init__( files: List[str], format: Optional[str] = None, preferred_data_archive_auth_method: Optional[str] = None, - **kwargs - ): + storage_subscription_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword format: File format. :paramtype format: str @@ -281,11 +296,15 @@ def __init__( :keyword preferred_data_archive_auth_method: Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. :paramtype preferred_data_archive_auth_method: str + :keyword storage_subscription_id: Subscription id of the storage container containing files to + import using Managed Identity. + :paramtype storage_subscription_id: str """ super().__init__(**kwargs) self.format = format self.files = files self.preferred_data_archive_auth_method = preferred_data_archive_auth_method + self.storage_subscription_id = storage_subscription_id class ManagedServiceIdentity(_serialization.Model): @@ -330,8 +349,8 @@ def __init__( *, type: Union[str, "_models.ManagedServiceIdentityType"], user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and @@ -370,7 +389,7 @@ class NotificationListResponse(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.UpgradeNotification"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.UpgradeNotification"]] = None, **kwargs: Any) -> None: """ :keyword value: List of all notifications. :paramtype value: list[~azure.mgmt.redis.models.UpgradeNotification] @@ -394,7 +413,9 @@ class Operation(_serialization.Model): "display": {"key": "display", "type": "OperationDisplay"}, } - def __init__(self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: """ :keyword name: Operation name: {provider}/{resource}/{operation}. :paramtype name: str @@ -433,8 +454,8 @@ def __init__( operation: Optional[str] = None, resource: Optional[str] = None, description: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword provider: Friendly name of the resource provider. :paramtype provider: str @@ -453,7 +474,8 @@ def __init__( class OperationListResult(_serialization.Model): - """Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + """Result of the request to list REST API operations. It contains a list of operations and a URL + nextLink to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -472,7 +494,7 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs: Any) -> None: """ :keyword value: List of operations supported by the resource provider. :paramtype value: list[~azure.mgmt.redis.models.Operation] @@ -532,8 +554,8 @@ def __init__( end_time: Optional[datetime.datetime] = None, operations: Optional[List["_models.OperationStatusResult"]] = None, error: Optional["_models.ErrorDetailAutoGenerated"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified ID for the async operation. :paramtype id: str @@ -617,8 +639,8 @@ def __init__( operations: Optional[List["_models.OperationStatusResult"]] = None, error: Optional["_models.ErrorDetailAutoGenerated"] = None, properties: Optional[Dict[str, Any]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword id: Fully qualified ID for the async operation. :paramtype id: str @@ -670,7 +692,7 @@ class PrivateEndpoint(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -703,7 +725,7 @@ class Resource(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -760,8 +782,8 @@ def __init__( *, private_endpoint: Optional["_models.PrivateEndpoint"] = None, private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword private_endpoint: The resource of private end point. :paramtype private_endpoint: ~azure.mgmt.redis.models.PrivateEndpoint @@ -787,7 +809,7 @@ class PrivateEndpointConnectionListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateEndpointConnection"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private endpoint connections. :paramtype value: list[~azure.mgmt.redis.models.PrivateEndpointConnection] @@ -834,7 +856,7 @@ class PrivateLinkResource(Resource): "required_zone_names": {"key": "properties.requiredZoneNames", "type": "[str]"}, } - def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs): + def __init__(self, *, required_zone_names: Optional[List[str]] = None, **kwargs: Any) -> None: """ :keyword required_zone_names: The private link resource Private link DNS zone name. :paramtype required_zone_names: list[str] @@ -856,7 +878,7 @@ class PrivateLinkResourceListResult(_serialization.Model): "value": {"key": "value", "type": "[PrivateLinkResource]"}, } - def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs: Any) -> None: """ :keyword value: Array of private link resources. :paramtype value: list[~azure.mgmt.redis.models.PrivateLinkResource] @@ -866,7 +888,8 @@ def __init__(self, *, value: Optional[List["_models.PrivateLinkResource"]] = Non class PrivateLinkServiceConnectionState(_serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. + """A collection of information about the state of the connection between service consumer and + provider. :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Known values are: "Pending", "Approved", and "Rejected". @@ -890,8 +913,8 @@ def __init__( status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, actions_required: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Known values are: "Pending", "Approved", and "Rejected". @@ -909,7 +932,8 @@ def __init__( class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. Variables are only populated by the server, and will be ignored when sending a request. @@ -935,7 +959,7 @@ class ProxyResource(Resource): "type": {"key": "type", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) @@ -963,7 +987,7 @@ class RedisAccessKeys(_serialization.Model): "secondary_key": {"key": "secondaryKey", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.primary_key = None @@ -1025,8 +1049,8 @@ def __init__( shard_count: Optional[int] = None, minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword redis_configuration: All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -1070,7 +1094,9 @@ def __init__( class RedisCommonPropertiesRedisConfiguration(_serialization.Model): # pylint: disable=too-many-instance-attributes - """All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. + """All Redis Settings. Few possible keys: + rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value + etc. Variables are only populated by the server, and will be ignored when sending a request. @@ -1116,6 +1142,9 @@ class RedisCommonPropertiesRedisConfiguration(_serialization.Model): # pylint: :ivar authnotrequired: Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view. :vartype authnotrequired: str + :ivar storage_subscription_id: SubscriptionId of the storage account for persistence (aof/rdb) + using ManagedIdentity. + :vartype storage_subscription_id: str """ _validation = { @@ -1142,6 +1171,7 @@ class RedisCommonPropertiesRedisConfiguration(_serialization.Model): # pylint: "preferred_data_persistence_auth_method": {"key": "preferred-data-persistence-auth-method", "type": "str"}, "zonal_configuration": {"key": "zonal-configuration", "type": "str"}, "authnotrequired": {"key": "authnotrequired", "type": "str"}, + "storage_subscription_id": {"key": "storage-subscription-id", "type": "str"}, } def __init__( @@ -1161,8 +1191,9 @@ def __init__( maxmemory_delta: Optional[str] = None, preferred_data_persistence_auth_method: Optional[str] = None, authnotrequired: Optional[str] = None, - **kwargs - ): + storage_subscription_id: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword additional_properties: Unmatched properties from the message are deserialized to this collection. @@ -1203,6 +1234,9 @@ def __init__( :keyword authnotrequired: Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view. :paramtype authnotrequired: str + :keyword storage_subscription_id: SubscriptionId of the storage account for persistence + (aof/rdb) using ManagedIdentity. + :paramtype storage_subscription_id: str """ super().__init__(**kwargs) self.additional_properties = additional_properties @@ -1222,6 +1256,7 @@ def __init__( self.preferred_data_persistence_auth_method = preferred_data_persistence_auth_method self.zonal_configuration = None self.authnotrequired = authnotrequired + self.storage_subscription_id = storage_subscription_id class RedisCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -1324,8 +1359,8 @@ def __init__( public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword zones: A list of availability zones denoting where the resource needs to come from. :paramtype zones: list[str] @@ -1472,8 +1507,8 @@ def __init__( public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword redis_configuration: All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -1531,7 +1566,8 @@ def __init__( class RedisFirewallRule(ProxyResource): - """A firewall rule on a redis cache has a name, and describes a contiguous range of IP addresses permitted to connect. + """A firewall rule on a redis cache has a name, and describes a contiguous range of IP addresses + permitted to connect. Variables are only populated by the server, and will be ignored when sending a request. @@ -1567,7 +1603,7 @@ class RedisFirewallRule(ProxyResource): "end_ip": {"key": "properties.endIP", "type": "str"}, } - def __init__(self, *, start_ip: str, end_ip: str, **kwargs): + def __init__(self, *, start_ip: str, end_ip: str, **kwargs: Any) -> None: """ :keyword start_ip: lowest IP address included in the range. Required. :paramtype start_ip: str @@ -1580,7 +1616,8 @@ def __init__(self, *, start_ip: str, end_ip: str, **kwargs): class RedisFirewallRuleCreateParameters(RedisFirewallRule): - """Parameters required for creating a firewall rule on redis cache. (Note, you can just use the FirewallRule type instead now.). + """Parameters required for creating a firewall rule on redis cache. (Note, you can just use the + FirewallRule type instead now.). Variables are only populated by the server, and will be ignored when sending a request. @@ -1616,7 +1653,7 @@ class RedisFirewallRuleCreateParameters(RedisFirewallRule): "end_ip": {"key": "properties.endIP", "type": "str"}, } - def __init__(self, *, start_ip: str, end_ip: str, **kwargs): + def __init__(self, *, start_ip: str, end_ip: str, **kwargs: Any) -> None: """ :keyword start_ip: lowest IP address included in the range. Required. :paramtype start_ip: str @@ -1646,7 +1683,7 @@ class RedisFirewallRuleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.RedisFirewallRule"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RedisFirewallRule"]] = None, **kwargs: Any) -> None: """ :keyword value: Results of the list firewall rules operation. :paramtype value: list[~azure.mgmt.redis.models.RedisFirewallRule] @@ -1673,7 +1710,7 @@ class RedisForceRebootResponse(_serialization.Model): "message": {"key": "message", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.message = None @@ -1717,7 +1754,7 @@ class RedisInstanceDetails(_serialization.Model): "is_primary": {"key": "isPrimary", "type": "bool"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.ssl_port = None @@ -1745,7 +1782,7 @@ class RedisLinkedServer(_serialization.Model): "id": {"key": "id", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -1795,8 +1832,8 @@ def __init__( linked_redis_cache_id: str, linked_redis_cache_location: str, server_role: Union[str, "_models.ReplicationRole"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. Required. :paramtype linked_redis_cache_id: str @@ -1858,8 +1895,8 @@ def __init__( linked_redis_cache_id: str, linked_redis_cache_location: str, server_role: Union[str, "_models.ReplicationRole"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. Required. :paramtype linked_redis_cache_id: str @@ -1925,8 +1962,8 @@ def __init__( linked_redis_cache_id: str, linked_redis_cache_location: str, server_role: Union[str, "_models.ReplicationRole"], - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. Required. :paramtype linked_redis_cache_id: str @@ -2001,8 +2038,8 @@ def __init__( linked_redis_cache_id: Optional[str] = None, linked_redis_cache_location: Optional[str] = None, server_role: Optional[Union[str, "_models.ReplicationRole"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. :paramtype linked_redis_cache_id: str @@ -2040,7 +2077,9 @@ class RedisLinkedServerWithPropertiesList(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.RedisLinkedServerWithProperties"]] = None, **kwargs): + def __init__( + self, *, value: Optional[List["_models.RedisLinkedServerWithProperties"]] = None, **kwargs: Any + ) -> None: """ :keyword value: List of linked servers (with properties) of a Redis cache. :paramtype value: list[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] @@ -2070,7 +2109,7 @@ class RedisListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.RedisResource"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RedisResource"]] = None, **kwargs: Any) -> None: """ :keyword value: List of Redis cache instances. :paramtype value: list[~azure.mgmt.redis.models.RedisResource] @@ -2117,7 +2156,7 @@ class RedisPatchSchedule(ProxyResource): "schedule_entries": {"key": "properties.scheduleEntries", "type": "[ScheduleEntry]"}, } - def __init__(self, *, schedule_entries: List["_models.ScheduleEntry"], **kwargs): + def __init__(self, *, schedule_entries: List["_models.ScheduleEntry"], **kwargs: Any) -> None: """ :keyword schedule_entries: List of patch schedules for a Redis cache. Required. :paramtype schedule_entries: list[~azure.mgmt.redis.models.ScheduleEntry] @@ -2147,7 +2186,7 @@ class RedisPatchScheduleListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, *, value: Optional[List["_models.RedisPatchSchedule"]] = None, **kwargs): + def __init__(self, *, value: Optional[List["_models.RedisPatchSchedule"]] = None, **kwargs: Any) -> None: """ :keyword value: Results of the list patch schedules operation. :paramtype value: list[~azure.mgmt.redis.models.RedisPatchSchedule] @@ -2275,8 +2314,8 @@ def __init__( public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword redis_configuration: All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -2366,8 +2405,8 @@ def __init__( reboot_type: Optional[Union[str, "_models.RebootType"]] = None, shard_id: Optional[int] = None, ports: Optional[List[int]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword reboot_type: Which Redis node(s) to reboot. Depending on this value data loss is possible. Known values are: "PrimaryNode", "SecondaryNode", and "AllNodes". @@ -2402,7 +2441,7 @@ class RedisRegenerateKeyParameters(_serialization.Model): "key_type": {"key": "keyType", "type": "str"}, } - def __init__(self, *, key_type: Union[str, "_models.RedisKeyType"], **kwargs): + def __init__(self, *, key_type: Union[str, "_models.RedisKeyType"], **kwargs: Any) -> None: """ :keyword key_type: The Redis access key to regenerate. Required. Known values are: "Primary" and "Secondary". @@ -2413,7 +2452,8 @@ def __init__(self, *, key_type: Union[str, "_models.RedisKeyType"], **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """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. @@ -2448,7 +2488,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2615,8 +2655,8 @@ def __init__( # pylint: disable=too-many-locals public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", subnet_id: Optional[str] = None, static_ip: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2759,8 +2799,8 @@ def __init__( minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", sku: Optional["_models.Sku"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -2871,8 +2911,8 @@ def __init__( minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, public_network_access: Union[str, "_models.PublicNetworkAccess"] = "Enabled", sku: Optional["_models.Sku"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword redis_configuration: All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value @@ -2952,8 +2992,8 @@ def __init__( day_of_week: Union[str, "_models.DayOfWeek"], start_hour_utc: int, maintenance_window: Optional[datetime.timedelta] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword day_of_week: Day of the week when a cache can be patched. Required. Known values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Everyday", and @@ -2999,8 +3039,13 @@ class Sku(_serialization.Model): } def __init__( - self, *, name: Union[str, "_models.SkuName"], family: Union[str, "_models.SkuFamily"], capacity: int, **kwargs - ): + self, + *, + name: Union[str, "_models.SkuName"], + family: Union[str, "_models.SkuFamily"], + capacity: int, + **kwargs: Any + ) -> None: """ :keyword name: The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium). Required. Known values are: "Basic", "Standard", and "Premium". @@ -3043,7 +3088,7 @@ class UpgradeNotification(_serialization.Model): "upsell_notification": {"key": "upsellNotification", "type": "{str}"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.name = None @@ -3072,7 +3117,7 @@ class UserAssignedIdentity(_serialization.Model): "client_id": {"key": "clientId", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.principal_id = None diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/__init__.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/__init__.py index beea845aa5be..8237f395ab5c 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/__init__.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/__init__.py @@ -16,7 +16,7 @@ from ._async_operation_status_operations import AsyncOperationStatusOperations 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__ = [ diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_async_operation_status_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_async_operation_status_operations.py index 255d3be6ac5c..3321a49b748f 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_async_operation_status_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_async_operation_status_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -28,10 +27,6 @@ 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]] @@ -43,7 +38,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +52,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** "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") @@ -111,10 +106,8 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( location=location, @@ -126,10 +119,11 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -146,4 +140,6 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py index 77b28b86ba82..1c37d7db9ed9 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_firewall_rules_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ 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]] @@ -45,7 +40,7 @@ def build_list_request(resource_group_name: str, cache_name: str, subscription_i _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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +54,7 @@ def build_list_request(resource_group_name: str, cache_name: str, subscription_i "cacheName": _SERIALIZER.url("cache_name", cache_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") @@ -76,8 +71,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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +87,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") @@ -111,7 +106,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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -126,7 +121,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") @@ -143,7 +138,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -158,7 +153,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") @@ -204,10 +199,8 @@ def list(self, resource_group_name: str, cache_name: str, **kwargs: Any) -> Iter _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisFirewallRuleListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisFirewallRuleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -230,7 +223,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 @@ -246,7 +239,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 @@ -254,14 +247,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RedisFirewallRuleListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -274,7 +268,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules" + } @overload def create_or_update( @@ -356,7 +352,7 @@ def create_or_update( :param rule_name: The name of the firewall rule. Required. :type rule_name: str :param parameters: Parameters supplied to the create or update redis firewall rule operation. - Is either a model type or a IO type. Required. + Is either a RedisFirewallRule type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisFirewallRule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -377,11 +373,9 @@ def 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisFirewallRule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisFirewallRule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -405,10 +399,11 @@ def create_or_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -425,11 +420,13 @@ def create_or_update( deserialized = self._deserialize("RedisFirewallRule", 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.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" + } @distributed_trace def get( @@ -459,10 +456,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisFirewallRule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisFirewallRule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -475,10 +470,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -495,7 +491,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -525,10 +523,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -541,10 +537,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,4 +554,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_linked_server_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_linked_server_operations.py index fab857885915..523a45fe3275 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_linked_server_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_linked_server_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ 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]] @@ -49,8 +44,8 @@ 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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +60,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") @@ -84,7 +79,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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +94,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") @@ -116,7 +111,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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +126,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") @@ -146,7 +141,7 @@ def build_list_request(resource_group_name: str, name: str, subscription_id: str _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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +155,7 @@ def build_list_request(resource_group_name: str, name: str, subscription_id: str "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") @@ -209,11 +204,9 @@ def _create_initial( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisLinkedServerWithProperties] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisLinkedServerWithProperties] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -237,10 +230,11 @@ def _create_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -257,11 +251,13 @@ def _create_initial( deserialized = self._deserialize("RedisLinkedServerWithProperties", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } @overload def begin_create( @@ -359,8 +355,8 @@ def begin_create( :param linked_server_name: The name of the linked server that is being added to the Redis cache. Required. :type linked_server_name: str - :param parameters: Parameters supplied to the Create Linked server operation. Is either a model - type or a IO type. Required. + :param parameters: Parameters supplied to the Create Linked server operation. Is either a + RedisLinkedServerCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisLinkedServerCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -381,16 +377,14 @@ def begin_create( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisLinkedServerWithProperties] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisLinkedServerWithProperties] = 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_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, @@ -411,7 +405,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: @@ -423,9 +417,11 @@ 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.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, linked_server_name: str, **kwargs: Any @@ -441,10 +437,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -457,10 +451,11 @@ def _delete_initial( # 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -473,7 +468,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } @distributed_trace def begin_delete( @@ -503,13 +500,11 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = 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._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -528,7 +523,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -540,9 +535,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } @distributed_trace def get( @@ -572,10 +569,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisLinkedServerWithProperties] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisLinkedServerWithProperties] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -588,10 +583,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,7 +604,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" + } @distributed_trace def list( @@ -629,10 +627,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisLinkedServerWithPropertiesList] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisLinkedServerWithPropertiesList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -655,7 +651,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 @@ -671,7 +667,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 @@ -679,14 +675,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RedisLinkedServerWithPropertiesList", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -699,4 +696,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py index 7c5775354517..df54efb3bb07 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ from .._serialization import Serializer from .._vendor import _convert_request -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +40,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,10 +86,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -114,7 +107,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 +123,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,14 +131,15 @@ 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 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,4 +152,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Cache/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.Cache/operations"} diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch_schedules_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch_schedules_operations.py index 1a6f2ffad94f..9d5a201b8976 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch_schedules_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_patch_schedules_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -30,10 +29,6 @@ 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]] @@ -47,7 +42,7 @@ def build_list_by_redis_resource_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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_redis_resource_request( "cacheName": _SERIALIZER.url("cache_name", cache_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") @@ -78,8 +73,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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -94,7 +89,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") @@ -113,7 +108,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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -128,7 +123,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") @@ -145,7 +140,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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -160,7 +155,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") @@ -208,10 +203,8 @@ def list_by_redis_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisPatchScheduleListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisPatchScheduleListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -234,7 +227,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 @@ -250,7 +243,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 @@ -258,14 +251,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RedisPatchScheduleListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -278,7 +272,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_redis_resource.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules"} # type: ignore + list_by_redis_resource.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/patchSchedules" + } @overload def create_or_update( @@ -360,8 +356,8 @@ def create_or_update( :param default: Default string modeled as parameter for auto generation to work correctly. "default" Required. :type default: str or ~azure.mgmt.redis.models.DefaultName - :param parameters: Parameters to set the patching schedule for Redis cache. Is either a model - type or a IO type. Required. + :param parameters: Parameters to set the patching schedule for Redis cache. Is either a + RedisPatchSchedule type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisPatchSchedule or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -382,11 +378,9 @@ def 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisPatchSchedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisPatchSchedule] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -410,10 +404,11 @@ def create_or_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -430,11 +425,13 @@ def create_or_update( deserialized = self._deserialize("RedisPatchSchedule", 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.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -465,10 +462,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -481,10 +476,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -497,7 +493,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" + } @distributed_trace def get( @@ -528,10 +526,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisPatchSchedule] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisPatchSchedule] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -544,10 +540,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -564,4 +561,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_endpoint_connections_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_endpoint_connections_operations.py index 27dab69f734f..ee49b679a412 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_endpoint_connections_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ 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]] @@ -47,7 +42,7 @@ def build_list_request(resource_group_name: str, cache_name: str, subscription_i _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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_request(resource_group_name: str, cache_name: str, subscription_i "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") @@ -82,7 +77,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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +94,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") @@ -120,8 +115,8 @@ def build_put_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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -138,7 +133,7 @@ def build_put_request( ), } - _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") @@ -161,7 +156,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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +173,7 @@ def build_delete_request( ), } - _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") @@ -227,10 +222,8 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -253,7 +246,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 @@ -269,7 +262,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 @@ -277,14 +270,15 @@ 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 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -297,7 +291,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections" + } @distributed_trace def get( @@ -328,10 +324,8 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -344,10 +338,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,7 +359,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _put_initial( self, @@ -385,11 +382,9 @@ def _put_initial( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -413,10 +408,11 @@ def _put_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -433,11 +429,13 @@ def _put_initial( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _put_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_put( @@ -535,8 +533,8 @@ def begin_put( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :param properties: The private endpoint connection properties. Is either a model type or a IO - type. Required. + :param properties: The private endpoint connection properties. Is either a + PrivateEndpointConnection type or a IO type. Required. :type properties: ~azure.mgmt.redis.models.PrivateEndpointConnection or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -557,16 +555,14 @@ def begin_put( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnection] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + 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._put_initial( # type: ignore + raw_result = self._put_initial( resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -587,7 +583,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: @@ -599,9 +595,11 @@ 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_put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -632,10 +630,8 @@ 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", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -648,10 +644,11 @@ 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -664,4 +661,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_link_resources_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_link_resources_operations.py index 93691c793752..e3d2798250c5 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_link_resources_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_private_link_resources_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -30,10 +29,6 @@ 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]] @@ -47,7 +42,7 @@ def build_list_by_redis_cache_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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +56,7 @@ def build_list_by_redis_cache_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") @@ -109,10 +104,8 @@ def list_by_redis_cache( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateLinkResourceListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -135,7 +128,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 @@ -151,7 +144,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 @@ -159,14 +152,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -179,4 +173,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_redis_cache.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources"} # type: ignore + list_by_redis_cache.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateLinkResources" + } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_redis_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_redis_operations.py index 2ab3c9a6d090..021cb3ebb3ad 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_redis_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_redis_operations.py @@ -6,7 +6,6 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload import urllib.parse @@ -32,10 +31,6 @@ 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]] @@ -47,8 +42,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +52,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "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") @@ -76,7 +71,7 @@ def build_list_upgrade_notifications_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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +85,7 @@ def build_list_upgrade_notifications_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") @@ -106,8 +101,8 @@ def build_create_request(resource_group_name: str, name: str, subscription_id: s _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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -121,7 +116,7 @@ def build_create_request(resource_group_name: str, name: str, subscription_id: s "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") @@ -138,8 +133,8 @@ def build_update_request(resource_group_name: str, name: str, subscription_id: s _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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -153,7 +148,7 @@ def build_update_request(resource_group_name: str, name: str, subscription_id: s "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") @@ -170,7 +165,7 @@ def build_delete_request(resource_group_name: str, name: str, subscription_id: s _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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -184,7 +179,7 @@ def build_delete_request(resource_group_name: str, name: str, subscription_id: s "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") @@ -199,7 +194,7 @@ def build_get_request(resource_group_name: str, name: str, subscription_id: str, _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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -213,7 +208,7 @@ def build_get_request(resource_group_name: str, name: str, subscription_id: str, "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") @@ -228,7 +223,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -241,7 +236,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "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") @@ -256,7 +251,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -265,7 +260,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "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") @@ -280,7 +275,7 @@ def build_list_keys_request(resource_group_name: str, name: str, subscription_id _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", "2022-06-01")) # type: Literal["2022-06-01"] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -294,7 +289,7 @@ def build_list_keys_request(resource_group_name: str, name: str, subscription_id "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") @@ -311,8 +306,8 @@ def build_regenerate_key_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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -326,7 +321,7 @@ def build_regenerate_key_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") @@ -343,8 +338,8 @@ def build_force_reboot_request(resource_group_name: str, name: str, subscription _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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -358,7 +353,7 @@ def build_force_reboot_request(resource_group_name: str, name: str, subscription "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") @@ -375,8 +370,8 @@ def build_import_data_request(resource_group_name: str, name: str, subscription_ _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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -390,7 +385,7 @@ def build_import_data_request(resource_group_name: str, name: str, subscription_ "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") @@ -407,8 +402,8 @@ def build_export_data_request(resource_group_name: str, name: str, subscription_ _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", "2022-06-01")) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -422,7 +417,7 @@ def build_export_data_request(resource_group_name: str, name: str, subscription_ "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") @@ -501,8 +496,8 @@ def check_name_availability( # pylint: disable=inconsistent-return-statements """Checks that the redis cache name is valid and is not already in use. :param parameters: Parameters supplied to the CheckNameAvailability Redis operation. The only - supported resource type is 'Microsoft.Cache/redis'. Is either a model type or a IO type. - Required. + supported resource type is 'Microsoft.Cache/redis'. Is either a CheckNameAvailabilityParameters + type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.CheckNameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -523,11 +518,9 @@ def check_name_availability( # pylint: disable=inconsistent-return-statements _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -548,10 +541,11 @@ def check_name_availability( # 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -564,7 +558,9 @@ def check_name_availability( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability" + } @distributed_trace def list_upgrade_notifications( @@ -586,10 +582,8 @@ def list_upgrade_notifications( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.NotificationListResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.NotificationListResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -613,7 +607,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 @@ -629,7 +623,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 @@ -637,14 +631,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("NotificationListResponse", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -657,7 +652,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_upgrade_notifications.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications"} # type: ignore + list_upgrade_notifications.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listUpgradeNotifications" + } def _create_initial( self, resource_group_name: str, name: str, parameters: Union[_models.RedisCreateParameters, IO], **kwargs: Any @@ -673,11 +670,9 @@ def _create_initial( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -700,10 +695,11 @@ def _create_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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -720,11 +716,13 @@ def _create_initial( deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + _create_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @overload def begin_create( @@ -806,8 +804,8 @@ def begin_create( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Parameters supplied to the Create Redis operation. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to the Create Redis operation. Is either a + RedisCreateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisCreateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -828,16 +826,14 @@ def begin_create( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisResource] = 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_initial( # type: ignore + raw_result = self._create_initial( resource_group_name=resource_group_name, name=name, parameters=parameters, @@ -857,7 +853,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: @@ -869,9 +865,11 @@ 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.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + begin_create.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } def _update_initial( self, resource_group_name: str, name: str, parameters: Union[_models.RedisUpdateParameters, IO], **kwargs: Any @@ -887,11 +885,9 @@ def _update_initial( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -914,10 +910,11 @@ def _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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -934,11 +931,13 @@ def _update_initial( deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @overload def begin_update( @@ -1020,8 +1019,8 @@ def begin_update( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Parameters supplied to the Update Redis operation. Is either a model type or - a IO type. Required. + :param parameters: Parameters supplied to the Update Redis operation. Is either a + RedisUpdateParameters type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1042,16 +1041,14 @@ def begin_update( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisResource] = 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._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, name=name, parameters=parameters, @@ -1071,7 +1068,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: @@ -1083,9 +1080,11 @@ 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_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -1101,10 +1100,8 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1116,10 +1113,11 @@ def _delete_initial( # 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1132,7 +1130,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -1157,13 +1157,11 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = 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._delete_initial( # type: ignore resource_group_name=resource_group_name, @@ -1181,7 +1179,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -1193,9 +1191,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @distributed_trace def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.RedisResource: @@ -1221,10 +1221,8 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Red _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisResource] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -1236,10 +1234,11 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Red 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1256,7 +1255,9 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Red return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" + } @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.RedisResource"]: @@ -1272,10 +1273,8 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1297,7 +1296,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 @@ -1313,7 +1312,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 @@ -1321,14 +1320,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RedisListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1341,7 +1341,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.Cache/redis"} # type: ignore + list_by_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis" + } @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.RedisResource"]: @@ -1355,10 +1357,8 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.RedisResource _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisListResult] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1379,7 +1379,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 @@ -1395,7 +1395,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 @@ -1403,14 +1403,15 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RedisListResult", 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1423,7 +1424,7 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis"} # type: ignore + list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis"} @distributed_trace def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.RedisAccessKeys: @@ -1450,10 +1451,8 @@ def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) # type: Literal["2022-06-01"] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisAccessKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.RedisAccessKeys] = kwargs.pop("cls", None) request = build_list_keys_request( resource_group_name=resource_group_name, @@ -1465,10 +1464,11 @@ def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1485,7 +1485,9 @@ def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode return deserialized - list_keys.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys"} # type: ignore + list_keys.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys" + } @overload def regenerate_key( @@ -1558,8 +1560,8 @@ def regenerate_key( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Specifies which key to regenerate. Is either a model type or a IO type. - Required. + :param parameters: Specifies which key to regenerate. Is either a RedisRegenerateKeyParameters + type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisRegenerateKeyParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1580,11 +1582,9 @@ def regenerate_key( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisAccessKeys] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisAccessKeys] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1607,10 +1607,11 @@ def regenerate_key( 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1627,7 +1628,9 @@ def regenerate_key( return deserialized - regenerate_key.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey"} # type: ignore + regenerate_key.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey" + } @overload def force_reboot( @@ -1696,8 +1699,8 @@ def force_reboot( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Specifies which Redis node(s) to reboot. Is either a model type or a IO - type. Required. + :param parameters: Specifies which Redis node(s) to reboot. Is either a RedisRebootParameters + type or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.RedisRebootParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1718,11 +1721,9 @@ def force_reboot( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RedisForceRebootResponse] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RedisForceRebootResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1745,10 +1746,11 @@ def force_reboot( 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1765,7 +1767,9 @@ def force_reboot( return deserialized - force_reboot.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot"} # type: ignore + force_reboot.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot" + } def _import_data_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, parameters: Union[_models.ImportRDBParameters, IO], **kwargs: Any @@ -1781,11 +1785,9 @@ def _import_data_initial( # pylint: disable=inconsistent-return-statements _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1808,10 +1810,11 @@ def _import_data_initial( # 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1824,7 +1827,9 @@ def _import_data_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _import_data_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import"} # type: ignore + _import_data_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import" + } @overload def begin_import_data( @@ -1904,8 +1909,8 @@ def begin_import_data( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Parameters for Redis import operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for Redis import operation. Is either a ImportRDBParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.ImportRDBParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1925,14 +1930,12 @@ def begin_import_data( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[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 = 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._import_data_initial( # type: ignore resource_group_name=resource_group_name, @@ -1952,7 +1955,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -1964,9 +1967,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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_import_data.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import"} # type: ignore + begin_import_data.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import" + } def _export_data_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, parameters: Union[_models.ExportRDBParameters, IO], **kwargs: Any @@ -1982,11 +1987,9 @@ def _export_data_initial( # pylint: disable=inconsistent-return-statements _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2009,10 +2012,11 @@ def _export_data_initial( # 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 - request, stream=False, **kwargs + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2025,7 +2029,9 @@ def _export_data_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _export_data_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export"} # type: ignore + _export_data_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export" + } @overload def begin_export_data( @@ -2105,8 +2111,8 @@ def begin_export_data( :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :param parameters: Parameters for Redis export operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for Redis export operation. Is either a ExportRDBParameters type + or a IO type. Required. :type parameters: ~azure.mgmt.redis.models.ExportRDBParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -2126,14 +2132,12 @@ def begin_export_data( _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", self._config.api_version) - ) # type: Literal["2022-06-01"] - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[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 = 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._export_data_initial( # type: ignore resource_group_name=resource_group_name, @@ -2153,7 +2157,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) 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: @@ -2165,6 +2169,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- 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_export_data.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export"} # type: ignore + begin_export_data.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export" + } diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_async_operation_status.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_async_operation_status.py index 60ecc5e7ed6a..1c3f5cd6993f 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_async_operation_status.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_async_operation_status.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheAsyncOperationStatus.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheAsyncOperationStatus.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_check_name_availability.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_check_name_availability.py index 217cb0e913fe..3e79d7e25f64 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_check_name_availability.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_check_name_availability.py @@ -35,6 +35,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheCheckNameAvailability.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create.py index 5763cb6c721f..4e6dd79a440e 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheCreate.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreate.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create_default_version.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create_default_version.py index 3b32e391387e..8ea34d8bc31b 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create_default_version.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create_default_version.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheCreateDefaultVersion.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreateDefaultVersion.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create_latest_version.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create_latest_version.py index 75bfa7439495..9d2742263e25 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create_latest_version.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_create_latest_version.py @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheCreateLatestVersion.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreateLatestVersion.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_delete.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_delete.py index c3565c852b42..f9ea731da4be 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_delete.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_delete.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheDelete.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheDelete.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_delete_private_endpoint_connection.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_delete_private_endpoint_connection.py index c05cbe7d5f8c..991ee7e453c4 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_delete_private_endpoint_connection.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_delete_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_export.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_export.py index 79a497e146f0..9cab9d275e68 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_export.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_export.py @@ -36,11 +36,12 @@ def main(): "container": "https://contosostorage.blob.core.window.net/urltoBlobContainer?sasKeyParameters", "format": "RDB", "prefix": "datadump1", + "storage-subscription-id": "storageSubId", }, ).result() print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheExport.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheExport.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_create.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_create.py index 7d3ee800c56f..d43334714a7f 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_create.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_create.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheFirewallRuleCreate.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleCreate.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_delete.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_delete.py index 2f2e680dfabb..23ea3abc4cd1 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_delete.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheFirewallRuleDelete.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_get.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_get.py index b98567dcea83..15a97b420b79 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_get.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rule_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheFirewallRuleGet.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rules_list.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rules_list.py index f2f170fc54ad..46acd5fd2ecf 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rules_list.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_firewall_rules_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheFirewallRulesList.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRulesList.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_force_reboot.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_force_reboot.py index 87a78b346d79..2c78ca4949e9 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_force_reboot.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_force_reboot.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheForceReboot.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheForceReboot.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_get.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_get.py index 0ca51dfda0b2..321c0bdabbab 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_get.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_get.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheGet.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGet.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_get_private_endpoint_connection.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_get_private_endpoint_connection.py index 0c582fe8d331..e17aedd0dc1f 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_get_private_endpoint_connection.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_get_private_endpoint_connection.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheGetPrivateEndpointConnection.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_import.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_import.py index 39b4baa90d80..76f437e8ef67 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_import.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_import.py @@ -32,11 +32,15 @@ def main(): response = client.redis.begin_import_data( resource_group_name="rg1", name="cache1", - parameters={"files": ["http://fileuris.contoso.com/pathtofile1"], "format": "RDB"}, + parameters={ + "files": ["http://fileuris.contoso.com/pathtofile1"], + "format": "RDB", + "storage-subscription-id": "storageSubId", + }, ).result() print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheImport.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheImport.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/linked_server_create.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_create.py similarity index 94% rename from sdk/redis/azure-mgmt-redis/generated_samples/linked_server_create.py rename to sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_create.py index 3258c7582ff8..54736ab998ad 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/linked_server_create.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_create.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-redis # USAGE - python linked_server_create.py + python redis_cache_linked_server_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheLinkedServer_Create.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Create.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/linked_server_delete.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_delete.py similarity index 92% rename from sdk/redis/azure-mgmt-redis/generated_samples/linked_server_delete.py rename to sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_delete.py index e62e2c2dc14a..ae956ad950c3 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/linked_server_delete.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_delete.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-redis # USAGE - python linked_server_delete.py + python redis_cache_linked_server_delete.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheLinkedServer_Delete.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Delete.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/linked_server_get.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_get.py similarity index 93% rename from sdk/redis/azure-mgmt-redis/generated_samples/linked_server_get.py rename to sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_get.py index 38d6d70a7df6..b448a35a6f90 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/linked_server_get.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_get.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-redis # USAGE - python linked_server_get.py + python redis_cache_linked_server_get.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheLinkedServer_Get.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Get.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/linked_server_list.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_list.py similarity index 92% rename from sdk/redis/azure-mgmt-redis/generated_samples/linked_server_list.py rename to sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_list.py index 2eec7fa62887..eabe3aea9ea0 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/linked_server_list.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_list.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-redis # USAGE - python linked_server_list.py + python redis_cache_linked_server_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, @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheLinkedServer_List.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_List.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list.py index 3b3533be6e1c..0030ac930054 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheList.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheList.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_by_resource_group.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_by_resource_group.py index 48be130612f1..c73587eec3f5 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_by_resource_group.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_by_resource_group.py @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheListByResourceGroup.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_keys.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_keys.py index 2a62c77a615e..e5028c36a68b 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_keys.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_keys.py @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheListKeys.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListKeys.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connection.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connections.py similarity index 92% rename from sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connection.py rename to sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connections.py index aa5f84d36f8a..5891c86c3aae 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connection.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connections.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-redis # USAGE - python redis_cache_list_private_endpoint_connection.py + python redis_cache_list_private_endpoint_connections.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(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheListPrivateEndpointConnections.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/storage_account_list_private_link_resources.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_link_resources.py similarity index 92% rename from sdk/redis/azure-mgmt-redis/generated_samples/storage_account_list_private_link_resources.py rename to sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_link_resources.py index e673ae51d052..4966d9d8c732 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/storage_account_list_private_link_resources.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_link_resources.py @@ -14,7 +14,7 @@ pip install azure-identity pip install azure-mgmt-redis # USAGE - python storage_account_list_private_link_resources.py + python redis_cache_list_private_link_resources.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(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheListPrivateLinkResources.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_upgrade_notifications.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_upgrade_notifications.py index 1f63d4c1d65d..14cea93aa6ea 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_upgrade_notifications.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_upgrade_notifications.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheListUpgradeNotifications.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListUpgradeNotifications.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_operations.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_operations.py index 30e4496e9122..d3df255b2f74 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_operations.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_operations.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheOperations.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheOperations.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_create_or_update.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_create_or_update.py index 25f48152e09f..a102ea618e06 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_create_or_update.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_create_or_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_delete.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_delete.py index f4ec8445f2e4..1a756edf0b1b 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_delete.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_delete.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCachePatchSchedulesDelete.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesDelete.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_get.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_get.py index f90ffcdae015..85267ac7761f 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_get.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCachePatchSchedulesGet.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesGet.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_list.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_list.py index 2376ba265d67..af8f3abc4275 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_list.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_patch_schedules_list.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCachePatchSchedulesList.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesList.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_put_private_endpoint_connection.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_put_private_endpoint_connection.py index e7c8a6c58e38..4bf688f31a01 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_put_private_endpoint_connection.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_put_private_endpoint_connection.py @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCachePutPrivateEndpointConnection.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePutPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_regenerate_key.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_regenerate_key.py index ee4c5439bc87..ff420dfcb41f 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_regenerate_key.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_regenerate_key.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheRegenerateKey.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheRegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_update.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_update.py index 4440f4992e0f..041362a2669d 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_update.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2022-06-01/examples/RedisCacheUpdate.json +# x-ms-original-file: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheUpdate.json if __name__ == "__main__": main()