diff --git a/sdk/redis/azure-mgmt-redis/README.md b/sdk/redis/azure-mgmt-redis/README.md index cad67835d066..61408744a0ea 100644 --- a/sdk/redis/azure-mgmt-redis/README.md +++ b/sdk/redis/azure-mgmt-redis/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Redis Cache Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-redis%2FREADME.png) diff --git a/sdk/redis/azure-mgmt-redis/_meta.json b/sdk/redis/azure-mgmt-redis/_meta.json index 03a7a00430db..a60d5c26cb3f 100644 --- a/sdk/redis/azure-mgmt-redis/_meta.json +++ b/sdk/redis/azure-mgmt-redis/_meta.json @@ -1,11 +1,11 @@ { - "commit": "c1d7ef4e6ff16ff97f24b1497c82de0b665310c5", + "commit": "0c3a2d520721f6d75ed25665eef4cb47de19bfa8", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.7", + "@autorest/modelerfour@4.27.0" ], - "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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --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.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --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/_configuration.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py index 1226e8b1fb88..c94b51a7ba48 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class RedisManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class RedisManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for RedisManagementClient. Note that all parameters used to create this instance are saved as instance @@ -35,7 +34,6 @@ class RedisManagementClientConfiguration(Configuration): # pylint: disable=too- """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(RedisManagementClientConfiguration, self).__init__(**kwargs) api_version: str = kwargs.pop("api_version", "2023-08-01") if credential is None: @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-redis/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( 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 e6c2e0df7900..22808acb4411 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 @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import RedisManagementClientConfiguration @@ -80,7 +82,25 @@ def __init__( self._config = RedisManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -105,7 +125,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -125,7 +145,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() 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 4bae2292227b..2f781d740827 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_serialization.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[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__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): 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: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): 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) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,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: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): 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) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj 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 dba2ea3bed66..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.3.0" +VERSION = "12.0.0b1" 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 134a969e829e..667f9c4f8008 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 @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class RedisManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class RedisManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for RedisManagementClient. Note that all parameters used to create this instance are saved as instance @@ -35,7 +34,6 @@ class RedisManagementClientConfiguration(Configuration): # pylint: disable=too- """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(RedisManagementClientConfiguration, self).__init__(**kwargs) api_version: str = kwargs.pop("api_version", "2023-08-01") if credential is None: @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-redis/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( 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 2004e81fc59c..5aff9649ae3a 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 @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -81,7 +83,25 @@ def __init__( self._config = RedisManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -106,7 +126,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -126,7 +148,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_access_policy_assignment_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_access_policy_assignment_operations.py index 816765f492d4..97ee9f3ec9df 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_access_policy_assignment_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_access_policy_assignment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -66,7 +66,7 @@ async def _create_update_initial( resource_group_name: str, cache_name: str, access_policy_assignment_name: str, - parameters: Union[_models.RedisCacheAccessPolicyAssignment, IO], + parameters: Union[_models.RedisCacheAccessPolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.RedisCacheAccessPolicyAssignment: error_map = { @@ -92,7 +92,7 @@ async def _create_update_initial( else: _json = self._serialize.body(parameters, "RedisCacheAccessPolicyAssignment") - request = build_create_update_request( + _request = build_create_update_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_assignment_name=access_policy_assignment_name, @@ -101,16 +101,15 @@ async def _create_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,10 +130,6 @@ async def _create_update_initial( return deserialized # type: ignore - _create_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } - @overload async def begin_create_update( self, @@ -161,14 +156,6 @@ async def begin_create_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: @@ -182,7 +169,7 @@ async def begin_create_update( resource_group_name: str, cache_name: str, access_policy_assignment_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -198,18 +185,10 @@ async def begin_create_update( :type access_policy_assignment_name: str :param parameters: Parameters supplied to the Create Update Access Policy Assignment operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: @@ -223,7 +202,7 @@ async def begin_create_update( resource_group_name: str, cache_name: str, access_policy_assignment_name: str, - parameters: Union[_models.RedisCacheAccessPolicyAssignment, IO], + parameters: Union[_models.RedisCacheAccessPolicyAssignment, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.RedisCacheAccessPolicyAssignment]: """Adds the access policy assignment to the specified users. @@ -236,19 +215,8 @@ async def begin_create_update( :param access_policy_assignment_name: The name of the access policy assignment. Required. :type access_policy_assignment_name: str :param parameters: Parameters supplied to the Create Update Access Policy Assignment operation. - Is either a RedisCacheAccessPolicyAssignment type or a IO type. Required. - :type parameters: ~azure.mgmt.redis.models.RedisCacheAccessPolicyAssignment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Is either a RedisCacheAccessPolicyAssignment type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisCacheAccessPolicyAssignment or IO[bytes] :return: An instance of AsyncLROPoller that returns either RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: @@ -282,7 +250,7 @@ async def begin_create_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisCacheAccessPolicyAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -292,17 +260,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.RedisCacheAccessPolicyAssignment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } + return AsyncLROPoller[_models.RedisCacheAccessPolicyAssignment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, access_policy_assignment_name: str, **kwargs: Any @@ -321,22 +287,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_assignment_name=access_policy_assignment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -351,11 +316,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -370,14 +331,6 @@ async def begin_delete( :type cache_name: str :param access_policy_assignment_name: The name of the access policy assignment. Required. :type access_policy_assignment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -405,7 +358,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -416,17 +369,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -441,7 +390,6 @@ async def get( :type cache_name: str :param access_policy_assignment_name: The name of the access policy assignment. Required. :type access_policy_assignment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisCacheAccessPolicyAssignment :raises ~azure.core.exceptions.HttpResponseError: @@ -460,22 +408,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RedisCacheAccessPolicyAssignment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_assignment_name=access_policy_assignment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -488,13 +435,9 @@ async def get( deserialized = self._deserialize("RedisCacheAccessPolicyAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -507,7 +450,6 @@ def list( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: @@ -531,17 +473,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -553,13 +494,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RedisCacheAccessPolicyAssignmentList", pipeline_response) @@ -569,11 +510,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,7 +526,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments" - } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_access_policy_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_access_policy_operations.py index ab40b45edd59..57145849bb98 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_access_policy_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/aio/operations/_access_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -66,7 +66,7 @@ async def _create_update_initial( resource_group_name: str, cache_name: str, access_policy_name: str, - parameters: Union[_models.RedisCacheAccessPolicy, IO], + parameters: Union[_models.RedisCacheAccessPolicy, IO[bytes]], **kwargs: Any ) -> _models.RedisCacheAccessPolicy: error_map = { @@ -92,7 +92,7 @@ async def _create_update_initial( else: _json = self._serialize.body(parameters, "RedisCacheAccessPolicy") - request = build_create_update_request( + _request = build_create_update_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_name=access_policy_name, @@ -101,16 +101,15 @@ async def _create_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,10 +130,6 @@ async def _create_update_initial( return deserialized # type: ignore - _create_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } - @overload async def begin_create_update( self, @@ -161,14 +156,6 @@ async def begin_create_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisCacheAccessPolicy] @@ -181,7 +168,7 @@ async def begin_create_update( resource_group_name: str, cache_name: str, access_policy_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -197,18 +184,10 @@ async def begin_create_update( cache. Required. :type access_policy_name: str :param parameters: Parameters supplied to the Create Update Access Policy operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisCacheAccessPolicy] @@ -221,7 +200,7 @@ async def begin_create_update( resource_group_name: str, cache_name: str, access_policy_name: str, - parameters: Union[_models.RedisCacheAccessPolicy, IO], + parameters: Union[_models.RedisCacheAccessPolicy, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.RedisCacheAccessPolicy]: """Adds an access policy to the redis cache. @@ -235,19 +214,8 @@ async def begin_create_update( cache. Required. :type access_policy_name: str :param parameters: Parameters supplied to the Create Update Access Policy operation. Is either - a RedisCacheAccessPolicy type or a IO type. Required. - :type parameters: ~azure.mgmt.redis.models.RedisCacheAccessPolicy or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a RedisCacheAccessPolicy type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisCacheAccessPolicy or IO[bytes] :return: An instance of AsyncLROPoller that returns either RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisCacheAccessPolicy] @@ -280,7 +248,7 @@ async def begin_create_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisCacheAccessPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -290,17 +258,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.RedisCacheAccessPolicy].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } + return AsyncLROPoller[_models.RedisCacheAccessPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, access_policy_name: str, **kwargs: Any @@ -319,22 +285,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_name=access_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -349,11 +314,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -369,14 +330,6 @@ async def begin_delete( :param access_policy_name: The name of the access policy that is being added to the Redis cache. Required. :type access_policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -404,7 +357,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -415,17 +368,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -441,7 +390,6 @@ async def get( :param access_policy_name: The name of the access policy that is being added to the Redis cache. Required. :type access_policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisCacheAccessPolicy :raises ~azure.core.exceptions.HttpResponseError: @@ -460,22 +408,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RedisCacheAccessPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_name=access_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -488,13 +435,9 @@ async def get( deserialized = self._deserialize("RedisCacheAccessPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -507,7 +450,6 @@ def list( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisCacheAccessPolicy or the result of cls(response) :rtype: @@ -531,17 +473,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -553,13 +494,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RedisCacheAccessPolicyList", pipeline_response) @@ -569,11 +510,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,7 +526,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies" - } 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 dfbee64de9fc..f9fba9c58132 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -58,7 +58,6 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. :type location: str :param operation_id: The ID of asynchronous operation. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.redis.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: @@ -77,21 +76,20 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. 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( + _request = build_get_request( location=location, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -104,10 +102,6 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}" - } + return deserialized # type: ignore 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 bdd09e54b91e..70cca7544d2e 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -70,7 +70,6 @@ def list( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisFirewallRule or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisFirewallRule] :raises ~azure.core.exceptions.HttpResponseError: @@ -92,17 +91,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +112,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RedisFirewallRuleListResult", pipeline_response) @@ -130,11 +128,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,10 +145,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/{cacheName}/firewallRules" - } - @overload async def create_or_update( self, @@ -177,7 +171,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisFirewallRule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises ~azure.core.exceptions.HttpResponseError: @@ -189,7 +182,7 @@ async def create_or_update( resource_group_name: str, cache_name: str, rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -205,11 +198,10 @@ async def create_or_update( :type rule_name: str :param parameters: Parameters supplied to the create or update redis firewall rule operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisFirewallRule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises ~azure.core.exceptions.HttpResponseError: @@ -221,7 +213,7 @@ async def create_or_update( resource_group_name: str, cache_name: str, rule_name: str, - parameters: Union[_models.RedisFirewallRule, IO], + parameters: Union[_models.RedisFirewallRule, IO[bytes]], **kwargs: Any ) -> _models.RedisFirewallRule: """Create or update a redis cache firewall rule. @@ -234,12 +226,8 @@ 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 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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + Is either a RedisFirewallRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisFirewallRule or IO[bytes] :return: RedisFirewallRule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises ~azure.core.exceptions.HttpResponseError: @@ -267,7 +255,7 @@ async def create_or_update( else: _json = self._serialize.body(parameters, "RedisFirewallRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, cache_name=cache_name, rule_name=rule_name, @@ -276,16 +264,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -306,10 +293,6 @@ async def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" - } - @distributed_trace_async async def get( self, resource_group_name: str, cache_name: str, rule_name: str, **kwargs: Any @@ -323,7 +306,6 @@ async def get( :type cache_name: str :param rule_name: The name of the firewall rule. Required. :type rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisFirewallRule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises ~azure.core.exceptions.HttpResponseError: @@ -342,22 +324,21 @@ async def get( 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( + _request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,13 +351,9 @@ async def get( deserialized = self._deserialize("RedisFirewallRule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" - } + return deserialized # type: ignore @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -391,7 +368,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :type cache_name: str :param rule_name: The name of the firewall rule. Required. :type rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -410,22 +386,21 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -436,8 +411,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" - } + return cls(pipeline_response, None, {}) # type: ignore 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 74a3a5f90084..da29aa5a3864 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -66,7 +66,7 @@ async def _create_initial( resource_group_name: str, name: str, linked_server_name: str, - parameters: Union[_models.RedisLinkedServerCreateParameters, IO], + parameters: Union[_models.RedisLinkedServerCreateParameters, IO[bytes]], **kwargs: Any ) -> _models.RedisLinkedServerWithProperties: error_map = { @@ -92,7 +92,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "RedisLinkedServerCreateParameters") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, @@ -101,16 +101,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,10 +130,6 @@ async def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" - } - @overload async def begin_create( self, @@ -161,14 +156,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisLinkedServerWithProperties or the result of cls(response) :rtype: @@ -182,7 +169,7 @@ async def begin_create( resource_group_name: str, name: str, linked_server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -198,18 +185,10 @@ async def begin_create( cache. Required. :type linked_server_name: str :param parameters: Parameters supplied to the Create Linked server operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisLinkedServerWithProperties or the result of cls(response) :rtype: @@ -223,7 +202,7 @@ async def begin_create( resource_group_name: str, name: str, linked_server_name: str, - parameters: Union[_models.RedisLinkedServerCreateParameters, IO], + parameters: Union[_models.RedisLinkedServerCreateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.RedisLinkedServerWithProperties]: """Adds a linked server to the Redis cache (requires Premium SKU). @@ -237,19 +216,8 @@ async def begin_create( cache. Required. :type linked_server_name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + RedisLinkedServerCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisLinkedServerCreateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either RedisLinkedServerWithProperties or the result of cls(response) :rtype: @@ -283,7 +251,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisLinkedServerWithProperties", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -293,17 +261,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.RedisLinkedServerWithProperties].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" - } + return AsyncLROPoller[_models.RedisLinkedServerWithProperties]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, linked_server_name: str, **kwargs: Any @@ -322,22 +288,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -352,11 +317,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -372,14 +333,6 @@ async def begin_delete( :param linked_server_name: The name of the linked server that is being added to the Redis cache. Required. :type linked_server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -407,7 +360,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -416,17 +369,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -441,7 +390,6 @@ async def get( :type name: str :param linked_server_name: The name of the linked server. Required. :type linked_server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisLinkedServerWithProperties or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisLinkedServerWithProperties :raises ~azure.core.exceptions.HttpResponseError: @@ -460,22 +408,21 @@ async def get( 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( + _request = build_get_request( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -488,13 +435,9 @@ async def get( deserialized = self._deserialize("RedisLinkedServerWithProperties", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -507,7 +450,6 @@ def list( :type resource_group_name: str :param name: The name of the redis cache. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisLinkedServerWithProperties or the result of cls(response) :rtype: @@ -531,17 +473,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -553,13 +494,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RedisLinkedServerWithPropertiesList", pipeline_response) @@ -569,11 +510,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,7 +526,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - 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 b8038240a005..ba1cca5768f9 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -56,7 +56,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available REST API operations of the Microsoft.Cache provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -78,14 +77,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +95,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -113,11 +111,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +127,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - 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 ae765ea15c01..aacd715c8d9b 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -70,7 +70,6 @@ def list_by_redis_resource( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisPatchSchedule or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisPatchSchedule] :raises ~azure.core.exceptions.HttpResponseError: @@ -92,17 +91,16 @@ def list_by_redis_resource( def prepare_request(next_link=None): if not next_link: - request = build_list_by_redis_resource_request( + _request = build_list_by_redis_resource_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_redis_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -114,13 +112,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RedisPatchScheduleListResult", pipeline_response) @@ -130,11 +128,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,10 +145,6 @@ 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" - } - @overload async def create_or_update( self, @@ -177,7 +171,6 @@ async def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisPatchSchedule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -189,7 +182,7 @@ async def create_or_update( resource_group_name: str, name: str, default: Union[str, _models.DefaultName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -205,11 +198,10 @@ async def create_or_update( "default" Required. :type default: str or ~azure.mgmt.redis.models.DefaultName :param parameters: Parameters to set the patching schedule for Redis cache. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisPatchSchedule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -221,7 +213,7 @@ async def create_or_update( resource_group_name: str, name: str, default: Union[str, _models.DefaultName], - parameters: Union[_models.RedisPatchSchedule, IO], + parameters: Union[_models.RedisPatchSchedule, IO[bytes]], **kwargs: Any ) -> _models.RedisPatchSchedule: """Create or replace the patching schedule for Redis cache. @@ -235,12 +227,8 @@ async def create_or_update( "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 - 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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + RedisPatchSchedule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisPatchSchedule or IO[bytes] :return: RedisPatchSchedule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -268,7 +256,7 @@ async def create_or_update( else: _json = self._serialize.body(parameters, "RedisPatchSchedule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, name=name, default=default, @@ -277,16 +265,15 @@ async def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -307,10 +294,6 @@ async def create_or_update( return deserialized # 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 self, resource_group_name: str, name: str, default: Union[str, _models.DefaultName], **kwargs: Any @@ -325,7 +308,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param default: Default string modeled as parameter for auto generation to work correctly. "default" Required. :type default: str or ~azure.mgmt.redis.models.DefaultName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -344,22 +326,21 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, name=name, default=default, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -370,11 +351,7 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def get( @@ -390,7 +367,6 @@ async def get( :param default: Default string modeled as parameter for auto generation to work correctly. "default" Required. :type default: str or ~azure.mgmt.redis.models.DefaultName - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisPatchSchedule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -409,22 +385,21 @@ async def get( 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( + _request = build_get_request( resource_group_name=resource_group_name, name=name, default=default, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -437,10 +412,6 @@ async def get( deserialized = self._deserialize("RedisPatchSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" - } + return deserialized # type: ignore 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 7963ab68ce83..cf8472ba2804 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -72,7 +72,6 @@ def list( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -96,17 +95,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -118,13 +116,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -134,11 +132,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,10 +149,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/{cacheName}/privateEndpointConnections" - } - @distributed_trace_async async def get( self, resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -169,7 +163,6 @@ async def get( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.redis.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -188,22 +181,21 @@ async def get( 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( + _request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -216,20 +208,16 @@ async def get( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore async def _put_initial( self, resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnection: error_map = { @@ -255,7 +243,7 @@ async def _put_initial( else: _json = self._serialize.body(properties, "PrivateEndpointConnection") - request = build_put_request( + _request = build_put_request( resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -264,16 +252,15 @@ async def _put_initial( content_type=content_type, json=_json, content=_content, - template_url=self._put_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -294,10 +281,6 @@ async def _put_initial( return deserialized # type: ignore - _put_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - @overload async def begin_put( self, @@ -324,14 +307,6 @@ async def begin_put( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] @@ -344,7 +319,7 @@ async def begin_put( resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -360,18 +335,10 @@ async def begin_put( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] @@ -384,7 +351,7 @@ async def begin_put( resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Update the state of specified private endpoint connection associated with the redis cache. @@ -398,19 +365,8 @@ async def begin_put( with the Azure resource. Required. :type private_endpoint_connection_name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.redis.models.PrivateEndpointConnection or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] @@ -443,7 +399,7 @@ async def begin_put( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -453,17 +409,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_put.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -479,7 +433,6 @@ async def delete( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -498,22 +451,21 @@ async def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -524,8 +476,4 @@ async def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore 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 681c0bcc9ff4..659d0fe3b7d1 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -63,7 +63,6 @@ def list_by_redis_cache( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.PrivateLinkResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -85,17 +84,16 @@ def list_by_redis_cache( def prepare_request(next_link=None): if not next_link: - request = build_list_by_redis_cache_request( + _request = build_list_by_redis_cache_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_redis_cache.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -107,13 +105,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -123,11 +121,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -139,7 +137,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - 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 e8721ee715f1..40337e038078 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -87,7 +87,6 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -95,17 +94,16 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem @overload async def check_name_availability( # pylint: disable=inconsistent-return-statements - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> None: """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'. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -113,18 +111,14 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem @distributed_trace_async async def check_name_availability( # pylint: disable=inconsistent-return-statements - self, parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + self, parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any ) -> None: """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 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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.CheckNameAvailabilityParameters or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -152,22 +146,21 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem else: _json = self._serialize.body(parameters, "CheckNameAvailabilityParameters") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -178,11 +171,7 @@ async def check_name_availability( # pylint: disable=inconsistent-return-statem raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_upgrade_notifications( @@ -197,7 +186,6 @@ def list_upgrade_notifications( :type name: str :param history: how many minutes in past to look for upgrade notifications. Required. :type history: float - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UpgradeNotification or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.UpgradeNotification] :raises ~azure.core.exceptions.HttpResponseError: @@ -219,18 +207,17 @@ def list_upgrade_notifications( def prepare_request(next_link=None): if not next_link: - request = build_list_upgrade_notifications_request( + _request = build_list_upgrade_notifications_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, history=history, api_version=api_version, - template_url=self.list_upgrade_notifications.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -242,13 +229,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("NotificationListResponse", pipeline_response) @@ -258,11 +245,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -275,12 +262,12 @@ 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" - } - async def _create_initial( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisCreateParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisCreateParameters, IO[bytes]], + **kwargs: Any ) -> _models.RedisResource: error_map = { 401: ClientAuthenticationError, @@ -305,7 +292,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "RedisCreateParameters") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -313,16 +300,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -343,10 +329,6 @@ async def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } - @overload async def begin_create( self, @@ -369,14 +351,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisResource] @@ -388,7 +362,7 @@ async def begin_create( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -401,18 +375,10 @@ async def begin_create( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Parameters supplied to the Create Redis operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisResource] @@ -421,7 +387,11 @@ async def begin_create( @distributed_trace_async async def begin_create( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisCreateParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisCreateParameters, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.RedisResource]: """Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. @@ -431,19 +401,8 @@ async def begin_create( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + RedisCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisCreateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisResource] @@ -475,7 +434,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -485,20 +444,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.RedisResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } + return AsyncLROPoller[_models.RedisResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisUpdateParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisUpdateParameters, IO[bytes]], + **kwargs: Any ) -> _models.RedisResource: error_map = { 401: ClientAuthenticationError, @@ -523,7 +484,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "RedisUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -531,16 +492,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -561,10 +521,6 @@ async def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } - @overload async def begin_update( self, @@ -587,14 +543,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisResource] @@ -606,7 +554,7 @@ async def begin_update( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -619,18 +567,10 @@ async def begin_update( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Parameters supplied to the Update Redis operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisResource] @@ -639,7 +579,11 @@ async def begin_update( @distributed_trace_async async def begin_update( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisUpdateParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisUpdateParameters, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.RedisResource]: """Update an existing Redis cache. @@ -649,19 +593,8 @@ async def begin_update( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + RedisUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.RedisResource] @@ -693,7 +626,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -703,17 +636,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.RedisResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } + return AsyncLROPoller[_models.RedisResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -732,21 +663,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -757,11 +687,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace_async async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> AsyncLROPoller[None]: @@ -772,14 +698,6 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -806,7 +724,7 @@ async def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -815,17 +733,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(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}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.RedisResource: @@ -836,7 +750,6 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisResource or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisResource :raises ~azure.core.exceptions.HttpResponseError: @@ -855,21 +768,20 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode 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( + _request = build_get_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -882,13 +794,9 @@ async def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.RedisResource"]: @@ -897,7 +805,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -919,16 +826,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -940,13 +846,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RedisListResult", pipeline_response) @@ -956,11 +862,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -973,15 +879,10 @@ 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" - } - @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.RedisResource"]: """Gets all Redis caches in the specified subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redis.models.RedisResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -1003,15 +904,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.RedisRes def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1023,13 +923,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("RedisListResult", pipeline_response) @@ -1039,11 +939,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1056,8 +956,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - 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: """Retrieve a Redis cache's access keys. This operation requires write permission to the cache @@ -1068,7 +966,6 @@ async def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisAccessKeys or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises ~azure.core.exceptions.HttpResponseError: @@ -1087,21 +984,20 @@ async def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> 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( + _request = build_list_keys_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1114,13 +1010,9 @@ async def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> deserialized = self._deserialize("RedisAccessKeys", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys" - } + return deserialized # type: ignore @overload async def regenerate_key( @@ -1145,7 +1037,6 @@ async def regenerate_key( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisAccessKeys or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises ~azure.core.exceptions.HttpResponseError: @@ -1156,7 +1047,7 @@ async def regenerate_key( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1170,11 +1061,10 @@ async def regenerate_key( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Specifies which key to regenerate. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisAccessKeys or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises ~azure.core.exceptions.HttpResponseError: @@ -1185,7 +1075,7 @@ async def regenerate_key( self, resource_group_name: str, name: str, - parameters: Union[_models.RedisRegenerateKeyParameters, IO], + parameters: Union[_models.RedisRegenerateKeyParameters, IO[bytes]], **kwargs: Any ) -> _models.RedisAccessKeys: """Regenerate Redis cache's access keys. This operation requires write permission to the cache @@ -1197,12 +1087,8 @@ async def regenerate_key( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisRegenerateKeyParameters or IO[bytes] :return: RedisAccessKeys or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises ~azure.core.exceptions.HttpResponseError: @@ -1230,7 +1116,7 @@ async def regenerate_key( else: _json = self._serialize.body(parameters, "RedisRegenerateKeyParameters") - request = build_regenerate_key_request( + _request = build_regenerate_key_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -1238,16 +1124,15 @@ async def regenerate_key( content_type=content_type, json=_json, content=_content, - template_url=self.regenerate_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1260,13 +1145,9 @@ async def regenerate_key( deserialized = self._deserialize("RedisAccessKeys", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - regenerate_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey" - } + return deserialized # type: ignore @overload async def force_reboot( @@ -1291,7 +1172,6 @@ async def force_reboot( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisForceRebootResponse or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1302,7 +1182,7 @@ async def force_reboot( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1316,11 +1196,10 @@ async def force_reboot( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Specifies which Redis node(s) to reboot. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisForceRebootResponse or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1328,7 +1207,11 @@ async def force_reboot( @distributed_trace_async async def force_reboot( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisRebootParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisRebootParameters, IO[bytes]], + **kwargs: Any ) -> _models.RedisForceRebootResponse: """Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. @@ -1339,12 +1222,8 @@ async def force_reboot( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisRebootParameters or IO[bytes] :return: RedisForceRebootResponse or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1372,7 +1251,7 @@ async def force_reboot( else: _json = self._serialize.body(parameters, "RedisRebootParameters") - request = build_force_reboot_request( + _request = build_force_reboot_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -1380,16 +1259,15 @@ async def force_reboot( content_type=content_type, json=_json, content=_content, - template_url=self.force_reboot.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1402,16 +1280,16 @@ async def force_reboot( deserialized = self._deserialize("RedisForceRebootResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - force_reboot.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot" - } + return deserialized # type: ignore async def _import_data_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, parameters: Union[_models.ImportRDBParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.ImportRDBParameters, IO[bytes]], + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1436,7 +1314,7 @@ async def _import_data_initial( # pylint: disable=inconsistent-return-statement else: _json = self._serialize.body(parameters, "ImportRDBParameters") - request = build_import_data_request( + _request = build_import_data_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -1444,16 +1322,15 @@ async def _import_data_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, content=_content, - template_url=self._import_data_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1464,11 +1341,7 @@ async def _import_data_initial( # pylint: disable=inconsistent-return-statement raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _import_data_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def begin_import_data( @@ -1492,14 +1365,6 @@ async def begin_import_data( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1510,7 +1375,7 @@ async def begin_import_data( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1523,18 +1388,10 @@ async def begin_import_data( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Parameters for Redis import operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1542,7 +1399,11 @@ async def begin_import_data( @distributed_trace_async async def begin_import_data( - self, resource_group_name: str, name: str, parameters: Union[_models.ImportRDBParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.ImportRDBParameters, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[None]: """Import data into Redis cache. @@ -1552,19 +1413,8 @@ async def begin_import_data( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.ImportRDBParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1594,7 +1444,7 @@ async def begin_import_data( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -1603,20 +1453,20 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(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" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _export_data_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, parameters: Union[_models.ExportRDBParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.ExportRDBParameters, IO[bytes]], + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1641,7 +1491,7 @@ async def _export_data_initial( # pylint: disable=inconsistent-return-statement else: _json = self._serialize.body(parameters, "ExportRDBParameters") - request = build_export_data_request( + _request = build_export_data_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -1649,16 +1499,15 @@ async def _export_data_initial( # pylint: disable=inconsistent-return-statement content_type=content_type, json=_json, content=_content, - template_url=self._export_data_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1669,11 +1518,7 @@ async def _export_data_initial( # pylint: disable=inconsistent-return-statement raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _export_data_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export" - } + return cls(pipeline_response, None, {}) # type: ignore @overload async def begin_export_data( @@ -1697,14 +1542,6 @@ async def begin_export_data( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1715,7 +1552,7 @@ async def begin_export_data( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1728,18 +1565,10 @@ async def begin_export_data( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Parameters for Redis export operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1747,7 +1576,11 @@ async def begin_export_data( @distributed_trace_async async def begin_export_data( - self, resource_group_name: str, name: str, parameters: Union[_models.ExportRDBParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.ExportRDBParameters, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[None]: """Export data from the redis cache to blobs in a container. @@ -1757,19 +1590,8 @@ async def begin_export_data( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.ExportRDBParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1799,7 +1621,7 @@ async def begin_export_data( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) @@ -1808,17 +1630,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(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" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore async def _flush_cache_initial( self, resource_group_name: str, cache_name: str, **kwargs: Any @@ -1837,21 +1655,20 @@ async def _flush_cache_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - request = build_flush_cache_request( + _request = build_flush_cache_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._flush_cache_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1878,13 +1695,9 @@ async def _flush_cache_initial( ) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _flush_cache_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/flush" - } + return deserialized # type: ignore @distributed_trace_async async def begin_flush_cache( @@ -1897,14 +1710,6 @@ async def begin_flush_cache( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either OperationStatusResult or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redis.models.OperationStatusResult] @@ -1940,7 +1745,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationStatusResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -1952,14 +1757,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.OperationStatusResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_flush_cache.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/flush" - } + return AsyncLROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 11053b8cbe24..1fe8e1ec111d 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 @@ -20,7 +20,7 @@ class CheckNameAvailabilityParameters(_serialization.Model): """Parameters body to pass for resource name availability check. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Resource name. Required. :vartype name: str @@ -147,7 +147,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A class ExportRDBParameters(_serialization.Model): """Parameters for Redis export operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar format: File format. :vartype format: str @@ -211,7 +211,7 @@ def __init__( class ImportRDBParameters(_serialization.Model): """Parameters for Redis import operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar format: File format. :vartype format: str @@ -269,7 +269,7 @@ class ManagedServiceIdentity(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar principal_id: The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. @@ -283,7 +283,7 @@ class ManagedServiceIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.redis.models.ManagedServiceIdentityType :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :vartype user_assigned_identities: dict[str, ~azure.mgmt.redis.models.UserAssignedIdentity] """ @@ -315,7 +315,7 @@ def __init__( :paramtype type: str or ~azure.mgmt.redis.models.ManagedServiceIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.redis.models.UserAssignedIdentity] """ @@ -464,7 +464,7 @@ def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwarg class OperationStatusResult(_serialization.Model): """The current status of an async operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified ID for the async operation. :vartype id: str @@ -545,7 +545,7 @@ def __init__( class OperationStatus(OperationStatusResult): """Asynchronous operation status. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified ID for the async operation. :vartype id: str @@ -661,7 +661,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -696,7 +696,7 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -781,7 +781,7 @@ class PrivateLinkResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -895,7 +895,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -904,22 +904,6 @@ class ProxyResource(Resource): :vartype type: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class RedisAccessKeys(_serialization.Model): """Redis cache access keys. @@ -957,7 +941,7 @@ class RedisCacheAccessPolicy(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1010,7 +994,7 @@ class RedisCacheAccessPolicyAssignment(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1138,7 +1122,7 @@ class RedisCommonProperties(_serialization.Model): """Create/Update/Get common properties of the redis cache. :ivar 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 + 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 # pylint: disable=line-too-long etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is @@ -1200,7 +1184,7 @@ def __init__( ) -> 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 + 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 # pylint: disable=line-too-long etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration @@ -1284,6 +1268,8 @@ class RedisCommonPropertiesRedisConfiguration(_serialization.Model): # pylint: :vartype maxmemory_delta: str :ivar maxclients: The max clients config. :vartype maxclients: str + :ivar notify_keyspace_events: The keyspace events which should be monitored. + :vartype notify_keyspace_events: str :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 @@ -1323,6 +1309,7 @@ class RedisCommonPropertiesRedisConfiguration(_serialization.Model): # pylint: "maxmemory_reserved": {"key": "maxmemory-reserved", "type": "str"}, "maxmemory_delta": {"key": "maxmemory-delta", "type": "str"}, "maxclients": {"key": "maxclients", "type": "str"}, + "notify_keyspace_events": {"key": "notify-keyspace-events", "type": "str"}, "preferred_data_archive_auth_method": {"key": "preferred-data-archive-auth-method", "type": "str"}, "preferred_data_persistence_auth_method": {"key": "preferred-data-persistence-auth-method", "type": "str"}, "zonal_configuration": {"key": "zonal-configuration", "type": "str"}, @@ -1346,6 +1333,7 @@ def __init__( maxmemory_policy: Optional[str] = None, maxmemory_reserved: Optional[str] = None, maxmemory_delta: Optional[str] = None, + notify_keyspace_events: Optional[str] = None, preferred_data_persistence_auth_method: Optional[str] = None, authnotrequired: Optional[str] = None, storage_subscription_id: Optional[str] = None, @@ -1385,6 +1373,8 @@ def __init__( :keyword maxmemory_delta: Value in megabytes reserved for non-cache usage per shard e.g. failover. :paramtype maxmemory_delta: str + :keyword notify_keyspace_events: The keyspace events which should be monitored. + :paramtype notify_keyspace_events: str :keyword preferred_data_persistence_auth_method: Preferred auth method to communicate to storage account used for data persistence, specify SAS or ManagedIdentity, default value is SAS. @@ -1413,6 +1403,7 @@ def __init__( self.maxmemory_reserved = maxmemory_reserved self.maxmemory_delta = maxmemory_delta self.maxclients = None + self.notify_keyspace_events = notify_keyspace_events self.preferred_data_archive_auth_method = None self.preferred_data_persistence_auth_method = preferred_data_persistence_auth_method self.zonal_configuration = None @@ -1424,7 +1415,7 @@ def __init__( class RedisCreateParameters(_serialization.Model): # pylint: disable=too-many-instance-attributes """Parameters supplied to the Create Redis operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar zones: A list of availability zones denoting where the resource needs to come from. :vartype zones: list[str] @@ -1435,7 +1426,7 @@ class RedisCreateParameters(_serialization.Model): # pylint: disable=too-many-i :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity :ivar 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 + 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 # pylint: disable=line-too-long etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is @@ -1469,7 +1460,7 @@ class RedisCreateParameters(_serialization.Model): # pylint: disable=too-many-i :vartype sku: ~azure.mgmt.redis.models.Sku :ivar subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. # pylint: disable=line-too-long :vartype subnet_id: str :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -1540,7 +1531,7 @@ def __init__( :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity :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 + 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 # pylint: disable=line-too-long etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration @@ -1576,7 +1567,7 @@ def __init__( :paramtype sku: ~azure.mgmt.redis.models.Sku :keyword subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. # pylint: disable=line-too-long :paramtype subnet_id: str :keyword static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -1605,10 +1596,10 @@ def __init__( class RedisCreateProperties(RedisCommonProperties): # pylint: disable=too-many-instance-attributes """Properties supplied to Create Redis operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar 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 + 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 # pylint: disable=line-too-long etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is @@ -1642,7 +1633,7 @@ class RedisCreateProperties(RedisCommonProperties): # pylint: disable=too-many- :vartype sku: ~azure.mgmt.redis.models.Sku :ivar subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. # pylint: disable=line-too-long :vartype subnet_id: str :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -1693,7 +1684,7 @@ def __init__( ) -> 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 + 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 # pylint: disable=line-too-long etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration @@ -1729,7 +1720,7 @@ def __init__( :paramtype sku: ~azure.mgmt.redis.models.Sku :keyword subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. # pylint: disable=line-too-long :paramtype subnet_id: str :keyword static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -1759,10 +1750,10 @@ class RedisFirewallRule(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1809,10 +1800,10 @@ class RedisFirewallRuleCreateParameters(RedisFirewallRule): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1825,31 +1816,6 @@ class RedisFirewallRuleCreateParameters(RedisFirewallRule): :vartype end_ip: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "start_ip": {"required": True}, - "end_ip": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "start_ip": {"key": "properties.startIP", "type": "str"}, - "end_ip": {"key": "properties.endIP", "type": "str"}, - } - - 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 - :keyword end_ip: highest IP address included in the range. Required. - :paramtype end_ip: str - """ - super().__init__(start_ip=start_ip, end_ip=end_ip, **kwargs) - class RedisFirewallRuleListResult(_serialization.Model): """The response of list firewall rules Redis operation. @@ -1981,7 +1947,7 @@ class RedisLinkedServerCreateParameters(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. Required. :vartype linked_redis_cache_id: str @@ -2044,7 +2010,7 @@ class RedisLinkedServerCreateProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. Required. :vartype linked_redis_cache_id: str @@ -2107,7 +2073,7 @@ class RedisLinkedServerProperties(RedisLinkedServerCreateProperties): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar linked_redis_cache_id: Fully qualified resourceId of the linked redis cache. Required. :vartype linked_redis_cache_id: str @@ -2176,7 +2142,7 @@ class RedisLinkedServerWithProperties(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2312,10 +2278,10 @@ class RedisPatchSchedule(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2389,10 +2355,10 @@ class RedisProperties(RedisCreateProperties): # pylint: disable=too-many-instan Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar 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 + 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 # pylint: disable=line-too-long etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is @@ -2426,7 +2392,7 @@ class RedisProperties(RedisCreateProperties): # pylint: disable=too-many-instan :vartype sku: ~azure.mgmt.redis.models.Sku :ivar subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. # pylint: disable=line-too-long :vartype subnet_id: str :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -2513,7 +2479,7 @@ def __init__( ) -> 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 + 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 # pylint: disable=line-too-long etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration @@ -2549,7 +2515,7 @@ def __init__( :paramtype sku: ~azure.mgmt.redis.models.Sku :keyword subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. # pylint: disable=line-too-long :paramtype subnet_id: str :keyword static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -2627,7 +2593,7 @@ def __init__( class RedisRegenerateKeyParameters(_serialization.Model): """Specifies which Redis access keys to reset. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar key_type: The Redis access key to regenerate. Required. Known values are: "Primary" and "Secondary". @@ -2658,10 +2624,10 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2706,10 +2672,10 @@ class RedisResource(TrackedResource): # pylint: disable=too-many-instance-attri Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -2725,7 +2691,7 @@ class RedisResource(TrackedResource): # pylint: disable=too-many-instance-attri :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity :ivar 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 + 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 # pylint: disable=line-too-long etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is @@ -2759,7 +2725,7 @@ class RedisResource(TrackedResource): # pylint: disable=too-many-instance-attri :vartype sku: ~azure.mgmt.redis.models.Sku :ivar subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. # pylint: disable=line-too-long :vartype subnet_id: str :ivar static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -2875,7 +2841,7 @@ def __init__( # pylint: disable=too-many-locals :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity :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 + 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 # pylint: disable=line-too-long etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration @@ -2911,7 +2877,7 @@ def __init__( # pylint: disable=too-many-locals :paramtype sku: ~azure.mgmt.redis.models.Sku :keyword subnet_id: The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. # pylint: disable=line-too-long :paramtype subnet_id: str :keyword static_ip: Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -2951,7 +2917,7 @@ class RedisUpdateParameters(_serialization.Model): # pylint: disable=too-many-i :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity :ivar 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 + 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 # pylint: disable=line-too-long etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is @@ -3028,7 +2994,7 @@ def __init__( :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.redis.models.ManagedServiceIdentity :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 + 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 # pylint: disable=line-too-long etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration @@ -3083,7 +3049,7 @@ class RedisUpdateProperties(RedisCommonProperties): # pylint: disable=too-many- """Patchable properties of the redis cache. :ivar 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 + 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 # pylint: disable=line-too-long etc. :vartype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration :ivar redis_version: Redis version. This should be in the form 'major[.minor]' (only 'major' is @@ -3149,7 +3115,7 @@ def __init__( ) -> 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 + 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 # pylint: disable=line-too-long etc. :paramtype redis_configuration: ~azure.mgmt.redis.models.RedisCommonPropertiesRedisConfiguration @@ -3203,7 +3169,7 @@ def __init__( class ScheduleEntry(_serialization.Model): """Patch schedule entry for a Premium Redis Cache. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar 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 @@ -3253,7 +3219,7 @@ def __init__( class Sku(_serialization.Model): """SKU parameters supplied to the create Redis operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium). Required. Known values are: "Basic", "Standard", and "Premium". diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_access_policy_assignment_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_access_policy_assignment_operations.py index c2cefc2dc6c4..43e29b9c0de9 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_access_policy_assignment_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_access_policy_assignment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -228,7 +228,7 @@ def _create_update_initial( resource_group_name: str, cache_name: str, access_policy_assignment_name: str, - parameters: Union[_models.RedisCacheAccessPolicyAssignment, IO], + parameters: Union[_models.RedisCacheAccessPolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.RedisCacheAccessPolicyAssignment: error_map = { @@ -254,7 +254,7 @@ def _create_update_initial( else: _json = self._serialize.body(parameters, "RedisCacheAccessPolicyAssignment") - request = build_create_update_request( + _request = build_create_update_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_assignment_name=access_policy_assignment_name, @@ -263,16 +263,15 @@ def _create_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,10 +292,6 @@ def _create_update_initial( return deserialized # type: ignore - _create_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } - @overload def begin_create_update( self, @@ -323,14 +318,6 @@ def begin_create_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: @@ -344,7 +331,7 @@ def begin_create_update( resource_group_name: str, cache_name: str, access_policy_assignment_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -360,18 +347,10 @@ def begin_create_update( :type access_policy_assignment_name: str :param parameters: Parameters supplied to the Create Update Access Policy Assignment operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: @@ -385,7 +364,7 @@ def begin_create_update( resource_group_name: str, cache_name: str, access_policy_assignment_name: str, - parameters: Union[_models.RedisCacheAccessPolicyAssignment, IO], + parameters: Union[_models.RedisCacheAccessPolicyAssignment, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.RedisCacheAccessPolicyAssignment]: """Adds the access policy assignment to the specified users. @@ -398,19 +377,8 @@ def begin_create_update( :param access_policy_assignment_name: The name of the access policy assignment. Required. :type access_policy_assignment_name: str :param parameters: Parameters supplied to the Create Update Access Policy Assignment operation. - Is either a RedisCacheAccessPolicyAssignment type or a IO type. Required. - :type parameters: ~azure.mgmt.redis.models.RedisCacheAccessPolicyAssignment or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + Is either a RedisCacheAccessPolicyAssignment type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisCacheAccessPolicyAssignment or IO[bytes] :return: An instance of LROPoller that returns either RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: @@ -444,7 +412,7 @@ def begin_create_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisCacheAccessPolicyAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -454,17 +422,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.RedisCacheAccessPolicyAssignment].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } + return LROPoller[_models.RedisCacheAccessPolicyAssignment]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, access_policy_assignment_name: str, **kwargs: Any @@ -483,22 +449,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_assignment_name=access_policy_assignment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -513,11 +478,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -532,14 +493,6 @@ def begin_delete( :type cache_name: str :param access_policy_assignment_name: The name of the access policy assignment. Required. :type access_policy_assignment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -567,7 +520,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -578,17 +531,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -603,7 +552,6 @@ def get( :type cache_name: str :param access_policy_assignment_name: The name of the access policy assignment. Required. :type access_policy_assignment_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisCacheAccessPolicyAssignment :raises ~azure.core.exceptions.HttpResponseError: @@ -622,22 +570,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RedisCacheAccessPolicyAssignment] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_assignment_name=access_policy_assignment_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,13 +597,9 @@ def get( deserialized = self._deserialize("RedisCacheAccessPolicyAssignment", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -669,7 +612,6 @@ def list( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisCacheAccessPolicyAssignment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisCacheAccessPolicyAssignment] @@ -692,17 +634,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -714,13 +655,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RedisCacheAccessPolicyAssignmentList", pipeline_response) @@ -730,11 +671,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -746,7 +687,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments" - } diff --git a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_access_policy_operations.py b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_access_policy_operations.py index 1eb7e03f307b..58f84d3e533d 100644 --- a/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_access_policy_operations.py +++ b/sdk/redis/azure-mgmt-redis/azure/mgmt/redis/operations/_access_policy_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -228,7 +228,7 @@ def _create_update_initial( resource_group_name: str, cache_name: str, access_policy_name: str, - parameters: Union[_models.RedisCacheAccessPolicy, IO], + parameters: Union[_models.RedisCacheAccessPolicy, IO[bytes]], **kwargs: Any ) -> _models.RedisCacheAccessPolicy: error_map = { @@ -254,7 +254,7 @@ def _create_update_initial( else: _json = self._serialize.body(parameters, "RedisCacheAccessPolicy") - request = build_create_update_request( + _request = build_create_update_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_name=access_policy_name, @@ -263,16 +263,15 @@ def _create_update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -293,10 +292,6 @@ def _create_update_initial( return deserialized # type: ignore - _create_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } - @overload def begin_create_update( self, @@ -323,14 +318,6 @@ def begin_create_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisCacheAccessPolicy] @@ -343,7 +330,7 @@ def begin_create_update( resource_group_name: str, cache_name: str, access_policy_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -359,18 +346,10 @@ def begin_create_update( cache. Required. :type access_policy_name: str :param parameters: Parameters supplied to the Create Update Access Policy operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisCacheAccessPolicy] @@ -383,7 +362,7 @@ def begin_create_update( resource_group_name: str, cache_name: str, access_policy_name: str, - parameters: Union[_models.RedisCacheAccessPolicy, IO], + parameters: Union[_models.RedisCacheAccessPolicy, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.RedisCacheAccessPolicy]: """Adds an access policy to the redis cache. @@ -397,19 +376,8 @@ def begin_create_update( cache. Required. :type access_policy_name: str :param parameters: Parameters supplied to the Create Update Access Policy operation. Is either - a RedisCacheAccessPolicy type or a IO type. Required. - :type parameters: ~azure.mgmt.redis.models.RedisCacheAccessPolicy or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + a RedisCacheAccessPolicy type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisCacheAccessPolicy or IO[bytes] :return: An instance of LROPoller that returns either RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisCacheAccessPolicy] @@ -442,7 +410,7 @@ def begin_create_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisCacheAccessPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -452,17 +420,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.RedisCacheAccessPolicy].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } + return LROPoller[_models.RedisCacheAccessPolicy]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cache_name: str, access_policy_name: str, **kwargs: Any @@ -481,22 +447,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_name=access_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -511,11 +476,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -531,14 +492,6 @@ def begin_delete( :param access_policy_name: The name of the access policy that is being added to the Redis cache. Required. :type access_policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -566,7 +519,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -577,17 +530,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -603,7 +552,6 @@ def get( :param access_policy_name: The name of the access policy that is being added to the Redis cache. Required. :type access_policy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisCacheAccessPolicy :raises ~azure.core.exceptions.HttpResponseError: @@ -622,22 +570,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.RedisCacheAccessPolicy] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, access_policy_name=access_policy_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -650,13 +597,9 @@ def get( deserialized = self._deserialize("RedisCacheAccessPolicy", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -669,7 +612,6 @@ def list( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisCacheAccessPolicy or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisCacheAccessPolicy] @@ -692,17 +634,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -714,13 +655,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RedisCacheAccessPolicyList", pipeline_response) @@ -730,11 +671,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -746,7 +687,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies" - } 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 b4b4eeb84c5d..41a047121339 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -90,7 +90,6 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat :type location: str :param operation_id: The ID of asynchronous operation. Required. :type operation_id: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: OperationStatus or the result of cls(response) :rtype: ~azure.mgmt.redis.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: @@ -109,21 +108,20 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat 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( + _request = build_get_request( location=location, operation_id=operation_id, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,10 +134,6 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat deserialized = self._deserialize("OperationStatus", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/locations/{location}/asyncOperations/{operationId}" - } + return deserialized # type: ignore 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 b22a986b5b0f..cf8363cc6514 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -209,7 +209,6 @@ def list(self, resource_group_name: str, cache_name: str, **kwargs: Any) -> Iter :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisFirewallRule or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisFirewallRule] :raises ~azure.core.exceptions.HttpResponseError: @@ -231,17 +230,16 @@ def list(self, resource_group_name: str, cache_name: str, **kwargs: Any) -> Iter def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -253,13 +251,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RedisFirewallRuleListResult", pipeline_response) @@ -269,11 +267,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -286,10 +284,6 @@ 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" - } - @overload def create_or_update( self, @@ -316,7 +310,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisFirewallRule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises ~azure.core.exceptions.HttpResponseError: @@ -328,7 +321,7 @@ def create_or_update( resource_group_name: str, cache_name: str, rule_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -344,11 +337,10 @@ def create_or_update( :type rule_name: str :param parameters: Parameters supplied to the create or update redis firewall rule operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisFirewallRule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises ~azure.core.exceptions.HttpResponseError: @@ -360,7 +352,7 @@ def create_or_update( resource_group_name: str, cache_name: str, rule_name: str, - parameters: Union[_models.RedisFirewallRule, IO], + parameters: Union[_models.RedisFirewallRule, IO[bytes]], **kwargs: Any ) -> _models.RedisFirewallRule: """Create or update a redis cache firewall rule. @@ -373,12 +365,8 @@ 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 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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + Is either a RedisFirewallRule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisFirewallRule or IO[bytes] :return: RedisFirewallRule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises ~azure.core.exceptions.HttpResponseError: @@ -406,7 +394,7 @@ def create_or_update( else: _json = self._serialize.body(parameters, "RedisFirewallRule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, cache_name=cache_name, rule_name=rule_name, @@ -415,16 +403,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -445,10 +432,6 @@ def create_or_update( return deserialized # type: ignore - create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" - } - @distributed_trace def get( self, resource_group_name: str, cache_name: str, rule_name: str, **kwargs: Any @@ -462,7 +445,6 @@ def get( :type cache_name: str :param rule_name: The name of the firewall rule. Required. :type rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisFirewallRule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisFirewallRule :raises ~azure.core.exceptions.HttpResponseError: @@ -481,22 +463,21 @@ def get( 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( + _request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -509,13 +490,9 @@ def get( deserialized = self._deserialize("RedisFirewallRule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" - } + return deserialized # type: ignore @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -530,7 +507,6 @@ def delete( # pylint: disable=inconsistent-return-statements :type cache_name: str :param rule_name: The name of the firewall rule. Required. :type rule_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -549,22 +525,21 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, cache_name=cache_name, rule_name=rule_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -575,8 +550,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/firewallRules/{ruleName}" - } + return cls(pipeline_response, None, {}) # type: ignore 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 e9d885b50ae7..a2e7e6e7aabe 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -199,7 +199,7 @@ def _create_initial( resource_group_name: str, name: str, linked_server_name: str, - parameters: Union[_models.RedisLinkedServerCreateParameters, IO], + parameters: Union[_models.RedisLinkedServerCreateParameters, IO[bytes]], **kwargs: Any ) -> _models.RedisLinkedServerWithProperties: error_map = { @@ -225,7 +225,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "RedisLinkedServerCreateParameters") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, @@ -234,16 +234,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -264,10 +263,6 @@ def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" - } - @overload def begin_create( self, @@ -294,14 +289,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisLinkedServerWithProperties or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] @@ -314,7 +301,7 @@ def begin_create( resource_group_name: str, name: str, linked_server_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -330,18 +317,10 @@ def begin_create( cache. Required. :type linked_server_name: str :param parameters: Parameters supplied to the Create Linked server operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisLinkedServerWithProperties or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] @@ -354,7 +333,7 @@ def begin_create( resource_group_name: str, name: str, linked_server_name: str, - parameters: Union[_models.RedisLinkedServerCreateParameters, IO], + parameters: Union[_models.RedisLinkedServerCreateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.RedisLinkedServerWithProperties]: """Adds a linked server to the Redis cache (requires Premium SKU). @@ -368,19 +347,8 @@ def begin_create( cache. Required. :type linked_server_name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + RedisLinkedServerCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisLinkedServerCreateParameters or IO[bytes] :return: An instance of LROPoller that returns either RedisLinkedServerWithProperties or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] @@ -413,7 +381,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisLinkedServerWithProperties", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -423,17 +391,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.RedisLinkedServerWithProperties].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" - } + return LROPoller[_models.RedisLinkedServerWithProperties]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, linked_server_name: str, **kwargs: Any @@ -452,22 +418,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -482,11 +447,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -502,14 +463,6 @@ def begin_delete( :param linked_server_name: The name of the linked server that is being added to the Redis cache. Required. :type linked_server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -537,7 +490,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -546,17 +499,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -571,7 +520,6 @@ def get( :type name: str :param linked_server_name: The name of the linked server. Required. :type linked_server_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisLinkedServerWithProperties or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisLinkedServerWithProperties :raises ~azure.core.exceptions.HttpResponseError: @@ -590,22 +538,21 @@ def get( 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( + _request = build_get_request( resource_group_name=resource_group_name, name=name, linked_server_name=linked_server_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -618,13 +565,9 @@ def get( deserialized = self._deserialize("RedisLinkedServerWithProperties", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/linkedServers/{linkedServerName}" - } + return deserialized # type: ignore @distributed_trace def list( @@ -637,7 +580,6 @@ def list( :type resource_group_name: str :param name: The name of the redis cache. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisLinkedServerWithProperties or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisLinkedServerWithProperties] @@ -660,17 +602,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -682,13 +623,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RedisLinkedServerWithPropertiesList", pipeline_response) @@ -698,11 +639,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -714,7 +655,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - 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 c395181c1f57..57ae4de907f6 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available REST API operations of the Microsoft.Cache provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -100,14 +99,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +133,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +149,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - 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 b0f910fa482a..f27abca9dffa 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -207,7 +207,6 @@ def list_by_redis_resource( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisPatchSchedule or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisPatchSchedule] :raises ~azure.core.exceptions.HttpResponseError: @@ -229,17 +228,16 @@ def list_by_redis_resource( def prepare_request(next_link=None): if not next_link: - request = build_list_by_redis_resource_request( + _request = build_list_by_redis_resource_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_redis_resource.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -251,13 +249,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RedisPatchScheduleListResult", pipeline_response) @@ -267,11 +265,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -284,10 +282,6 @@ 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" - } - @overload def create_or_update( self, @@ -314,7 +308,6 @@ def create_or_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisPatchSchedule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -326,7 +319,7 @@ def create_or_update( resource_group_name: str, name: str, default: Union[str, _models.DefaultName], - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -342,11 +335,10 @@ def create_or_update( "default" Required. :type default: str or ~azure.mgmt.redis.models.DefaultName :param parameters: Parameters to set the patching schedule for Redis cache. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisPatchSchedule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -358,7 +350,7 @@ def create_or_update( resource_group_name: str, name: str, default: Union[str, _models.DefaultName], - parameters: Union[_models.RedisPatchSchedule, IO], + parameters: Union[_models.RedisPatchSchedule, IO[bytes]], **kwargs: Any ) -> _models.RedisPatchSchedule: """Create or replace the patching schedule for Redis cache. @@ -372,12 +364,8 @@ def create_or_update( "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 - 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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + RedisPatchSchedule type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisPatchSchedule or IO[bytes] :return: RedisPatchSchedule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -405,7 +393,7 @@ def create_or_update( else: _json = self._serialize.body(parameters, "RedisPatchSchedule") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, name=name, default=default, @@ -414,16 +402,15 @@ def create_or_update( content_type=content_type, json=_json, content=_content, - template_url=self.create_or_update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,10 +431,6 @@ def create_or_update( return deserialized # 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 self, resource_group_name: str, name: str, default: Union[str, _models.DefaultName], **kwargs: Any @@ -462,7 +445,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param default: Default string modeled as parameter for auto generation to work correctly. "default" Required. :type default: str or ~azure.mgmt.redis.models.DefaultName - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -481,22 +463,21 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, name=name, default=default, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -507,11 +488,7 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def get( @@ -527,7 +504,6 @@ def get( :param default: Default string modeled as parameter for auto generation to work correctly. "default" Required. :type default: str or ~azure.mgmt.redis.models.DefaultName - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisPatchSchedule or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisPatchSchedule :raises ~azure.core.exceptions.HttpResponseError: @@ -546,22 +522,21 @@ def get( 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( + _request = build_get_request( resource_group_name=resource_group_name, name=name, default=default, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -574,10 +549,6 @@ def get( deserialized = self._deserialize("RedisPatchSchedule", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{default}" - } + return deserialized # type: ignore 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 8ce6f7ff03e3..afbe2894547b 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -231,7 +231,6 @@ def list( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.PrivateEndpointConnection] @@ -254,17 +253,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -276,13 +274,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -292,11 +290,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,10 +307,6 @@ 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" - } - @distributed_trace def get( self, resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -327,7 +321,6 @@ def get( :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.redis.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: @@ -346,22 +339,21 @@ def get( 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( + _request = build_get_request( resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -374,20 +366,16 @@ def get( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore def _put_initial( self, resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnection: error_map = { @@ -413,7 +401,7 @@ def _put_initial( else: _json = self._serialize.body(properties, "PrivateEndpointConnection") - request = build_put_request( + _request = build_put_request( resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -422,16 +410,15 @@ def _put_initial( content_type=content_type, json=_json, content=_content, - template_url=self._put_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -452,10 +439,6 @@ def _put_initial( return deserialized # type: ignore - _put_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - @overload def begin_put( self, @@ -482,14 +465,6 @@ def begin_put( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] @@ -502,7 +477,7 @@ def begin_put( resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -518,18 +493,10 @@ def begin_put( with the Azure resource. Required. :type private_endpoint_connection_name: str :param properties: The private endpoint connection properties. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] @@ -542,7 +509,7 @@ def begin_put( resource_group_name: str, cache_name: str, private_endpoint_connection_name: str, - properties: Union[_models.PrivateEndpointConnection, IO], + properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Update the state of specified private endpoint connection associated with the redis cache. @@ -556,19 +523,8 @@ def begin_put( with the Azure resource. Required. :type private_endpoint_connection_name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.redis.models.PrivateEndpointConnection or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.PrivateEndpointConnection] @@ -601,7 +557,7 @@ def begin_put( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -611,17 +567,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_put.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -637,7 +591,6 @@ def delete( # pylint: disable=inconsistent-return-statements :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -656,22 +609,21 @@ def delete( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, cache_name=cache_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.delete.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -682,8 +634,4 @@ def delete( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, {}) # type: ignore 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 ef01040d54d9..f0d0869fabc9 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -101,7 +101,6 @@ def list_by_redis_cache( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.PrivateLinkResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -123,17 +122,16 @@ def list_by_redis_cache( def prepare_request(next_link=None): if not next_link: - request = build_list_by_redis_cache_request( + _request = build_list_by_redis_cache_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_redis_cache.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -145,13 +143,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) @@ -161,11 +159,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -177,7 +175,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - 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 deb2e89410b7..38c827c1597d 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 @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -523,7 +523,6 @@ def check_name_availability( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -531,17 +530,16 @@ def check_name_availability( # pylint: disable=inconsistent-return-statements @overload def check_name_availability( # pylint: disable=inconsistent-return-statements - self, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> None: """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'. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -549,18 +547,14 @@ def check_name_availability( # pylint: disable=inconsistent-return-statements @distributed_trace def check_name_availability( # pylint: disable=inconsistent-return-statements - self, parameters: Union[_models.CheckNameAvailabilityParameters, IO], **kwargs: Any + self, parameters: Union[_models.CheckNameAvailabilityParameters, IO[bytes]], **kwargs: Any ) -> None: """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 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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.CheckNameAvailabilityParameters or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -588,22 +582,21 @@ def check_name_availability( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "CheckNameAvailabilityParameters") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -614,11 +607,7 @@ def check_name_availability( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def list_upgrade_notifications( @@ -633,7 +622,6 @@ def list_upgrade_notifications( :type name: str :param history: how many minutes in past to look for upgrade notifications. Required. :type history: float - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UpgradeNotification or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.UpgradeNotification] :raises ~azure.core.exceptions.HttpResponseError: @@ -655,18 +643,17 @@ def list_upgrade_notifications( def prepare_request(next_link=None): if not next_link: - request = build_list_upgrade_notifications_request( + _request = build_list_upgrade_notifications_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, history=history, api_version=api_version, - template_url=self.list_upgrade_notifications.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -678,13 +665,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("NotificationListResponse", pipeline_response) @@ -694,11 +681,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -711,12 +698,12 @@ 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" - } - def _create_initial( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisCreateParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisCreateParameters, IO[bytes]], + **kwargs: Any ) -> _models.RedisResource: error_map = { 401: ClientAuthenticationError, @@ -741,7 +728,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "RedisCreateParameters") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -749,16 +736,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -779,10 +765,6 @@ def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } - @overload def begin_create( self, @@ -805,14 +787,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisResource] @@ -824,7 +798,7 @@ def begin_create( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -837,18 +811,10 @@ def begin_create( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Parameters supplied to the Create Redis operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisResource] @@ -857,7 +823,11 @@ def begin_create( @distributed_trace def begin_create( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisCreateParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisCreateParameters, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.RedisResource]: """Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. @@ -867,19 +837,8 @@ def begin_create( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + RedisCreateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisCreateParameters or IO[bytes] :return: An instance of LROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisResource] @@ -911,7 +870,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -921,20 +880,22 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.RedisResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } + return LROPoller[_models.RedisResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisUpdateParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisUpdateParameters, IO[bytes]], + **kwargs: Any ) -> _models.RedisResource: error_map = { 401: ClientAuthenticationError, @@ -959,7 +920,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "RedisUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -967,16 +928,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -997,10 +957,6 @@ def _update_initial( return deserialized # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } - @overload def begin_update( self, @@ -1023,14 +979,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisResource] @@ -1042,7 +990,7 @@ def begin_update( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1055,18 +1003,10 @@ def begin_update( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Parameters supplied to the Update Redis operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisResource] @@ -1075,7 +1015,11 @@ def begin_update( @distributed_trace def begin_update( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisUpdateParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisUpdateParameters, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.RedisResource]: """Update an existing Redis cache. @@ -1085,19 +1029,8 @@ def begin_update( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + RedisUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters or IO[bytes] :return: An instance of LROPoller that returns either RedisResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.RedisResource] @@ -1129,7 +1062,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -1139,17 +1072,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.RedisResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } + return LROPoller[_models.RedisResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, name: str, **kwargs: Any @@ -1168,21 +1099,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements 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( + _request = build_delete_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1193,11 +1123,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } + return cls(pipeline_response, None, {}) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LROPoller[None]: @@ -1208,14 +1134,6 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1242,7 +1160,7 @@ def begin_delete(self, resource_group_name: str, name: str, **kwargs: Any) -> LR def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -1251,17 +1169,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(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}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.RedisResource: @@ -1272,7 +1186,6 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Red :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisResource or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisResource :raises ~azure.core.exceptions.HttpResponseError: @@ -1291,21 +1204,20 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Red 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( + _request = build_get_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1318,13 +1230,9 @@ def get(self, resource_group_name: str, name: str, **kwargs: Any) -> _models.Red deserialized = self._deserialize("RedisResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}" - } + return deserialized # type: ignore @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.RedisResource"]: @@ -1333,7 +1241,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -1355,16 +1262,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1376,13 +1282,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RedisListResult", pipeline_response) @@ -1392,11 +1298,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1409,15 +1315,10 @@ 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" - } - @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.RedisResource"]: """Gets all Redis caches in the specified subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RedisResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redis.models.RedisResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -1439,15 +1340,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.RedisResource def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1459,13 +1359,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("RedisListResult", pipeline_response) @@ -1475,11 +1375,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1492,8 +1392,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - 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: """Retrieve a Redis cache's access keys. This operation requires write permission to the cache @@ -1504,7 +1402,6 @@ def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode :type resource_group_name: str :param name: The name of the Redis cache. Required. :type name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisAccessKeys or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises ~azure.core.exceptions.HttpResponseError: @@ -1523,21 +1420,20 @@ def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode 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( + _request = build_list_keys_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_keys.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1550,13 +1446,9 @@ def list_keys(self, resource_group_name: str, name: str, **kwargs: Any) -> _mode deserialized = self._deserialize("RedisAccessKeys", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - list_keys.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/listKeys" - } + return deserialized # type: ignore @overload def regenerate_key( @@ -1581,7 +1473,6 @@ def regenerate_key( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisAccessKeys or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises ~azure.core.exceptions.HttpResponseError: @@ -1592,7 +1483,7 @@ def regenerate_key( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1606,11 +1497,10 @@ def regenerate_key( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Specifies which key to regenerate. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisAccessKeys or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises ~azure.core.exceptions.HttpResponseError: @@ -1621,7 +1511,7 @@ def regenerate_key( self, resource_group_name: str, name: str, - parameters: Union[_models.RedisRegenerateKeyParameters, IO], + parameters: Union[_models.RedisRegenerateKeyParameters, IO[bytes]], **kwargs: Any ) -> _models.RedisAccessKeys: """Regenerate Redis cache's access keys. This operation requires write permission to the cache @@ -1633,12 +1523,8 @@ def regenerate_key( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisRegenerateKeyParameters or IO[bytes] :return: RedisAccessKeys or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisAccessKeys :raises ~azure.core.exceptions.HttpResponseError: @@ -1666,7 +1552,7 @@ def regenerate_key( else: _json = self._serialize.body(parameters, "RedisRegenerateKeyParameters") - request = build_regenerate_key_request( + _request = build_regenerate_key_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -1674,16 +1560,15 @@ def regenerate_key( content_type=content_type, json=_json, content=_content, - template_url=self.regenerate_key.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1696,13 +1581,9 @@ def regenerate_key( deserialized = self._deserialize("RedisAccessKeys", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - regenerate_key.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/regenerateKey" - } + return deserialized # type: ignore @overload def force_reboot( @@ -1727,7 +1608,6 @@ def force_reboot( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisForceRebootResponse or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1738,7 +1618,7 @@ def force_reboot( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1752,11 +1632,10 @@ def force_reboot( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Specifies which Redis node(s) to reboot. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: RedisForceRebootResponse or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1764,7 +1643,11 @@ def force_reboot( @distributed_trace def force_reboot( - self, resource_group_name: str, name: str, parameters: Union[_models.RedisRebootParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.RedisRebootParameters, IO[bytes]], + **kwargs: Any ) -> _models.RedisForceRebootResponse: """Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. @@ -1775,12 +1658,8 @@ def force_reboot( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.RedisRebootParameters or IO[bytes] :return: RedisForceRebootResponse or the result of cls(response) :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1808,7 +1687,7 @@ def force_reboot( else: _json = self._serialize.body(parameters, "RedisRebootParameters") - request = build_force_reboot_request( + _request = build_force_reboot_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -1816,16 +1695,15 @@ def force_reboot( content_type=content_type, json=_json, content=_content, - template_url=self.force_reboot.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1838,16 +1716,16 @@ def force_reboot( deserialized = self._deserialize("RedisForceRebootResponse", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - force_reboot.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/forceReboot" - } + return deserialized # type: ignore def _import_data_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, parameters: Union[_models.ImportRDBParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.ImportRDBParameters, IO[bytes]], + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -1872,7 +1750,7 @@ def _import_data_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "ImportRDBParameters") - request = build_import_data_request( + _request = build_import_data_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -1880,16 +1758,15 @@ def _import_data_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._import_data_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1900,11 +1777,7 @@ def _import_data_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _import_data_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/import" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def begin_import_data( @@ -1928,14 +1801,6 @@ def begin_import_data( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1946,7 +1811,7 @@ def begin_import_data( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -1959,18 +1824,10 @@ def begin_import_data( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Parameters for Redis import operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -1978,7 +1835,11 @@ def begin_import_data( @distributed_trace def begin_import_data( - self, resource_group_name: str, name: str, parameters: Union[_models.ImportRDBParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.ImportRDBParameters, IO[bytes]], + **kwargs: Any ) -> LROPoller[None]: """Import data into Redis cache. @@ -1988,19 +1849,8 @@ def begin_import_data( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.ImportRDBParameters or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2030,7 +1880,7 @@ def begin_import_data( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -2039,20 +1889,20 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(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" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _export_data_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, name: str, parameters: Union[_models.ExportRDBParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.ExportRDBParameters, IO[bytes]], + **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, @@ -2077,7 +1927,7 @@ def _export_data_initial( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(parameters, "ExportRDBParameters") - request = build_export_data_request( + _request = build_export_data_request( resource_group_name=resource_group_name, name=name, subscription_id=self._config.subscription_id, @@ -2085,16 +1935,15 @@ def _export_data_initial( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self._export_data_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2105,11 +1954,7 @@ def _export_data_initial( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - _export_data_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/export" - } + return cls(pipeline_response, None, {}) # type: ignore @overload def begin_export_data( @@ -2133,14 +1978,6 @@ def begin_export_data( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2151,7 +1988,7 @@ def begin_export_data( self, resource_group_name: str, name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -2164,18 +2001,10 @@ def begin_export_data( :param name: The name of the Redis cache. Required. :type name: str :param parameters: Parameters for Redis export operation. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2183,7 +2012,11 @@ def begin_export_data( @distributed_trace def begin_export_data( - self, resource_group_name: str, name: str, parameters: Union[_models.ExportRDBParameters, IO], **kwargs: Any + self, + resource_group_name: str, + name: str, + parameters: Union[_models.ExportRDBParameters, IO[bytes]], + **kwargs: Any ) -> LROPoller[None]: """Export data from the redis cache to blobs in a container. @@ -2193,19 +2026,8 @@ def begin_export_data( :param name: The name of the Redis cache. Required. :type name: str :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. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.redis.models.ExportRDBParameters or IO[bytes] :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -2235,7 +2057,7 @@ def begin_export_data( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) @@ -2244,17 +2066,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(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" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore def _flush_cache_initial( self, resource_group_name: str, cache_name: str, **kwargs: Any @@ -2273,21 +2091,20 @@ def _flush_cache_initial( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Optional[_models.OperationStatusResult]] = kwargs.pop("cls", None) - request = build_flush_cache_request( + _request = build_flush_cache_request( resource_group_name=resource_group_name, cache_name=cache_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._flush_cache_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -2314,13 +2131,9 @@ def _flush_cache_initial( ) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _flush_cache_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/flush" - } + return deserialized # type: ignore @distributed_trace def begin_flush_cache( @@ -2333,14 +2146,6 @@ def begin_flush_cache( :type resource_group_name: str :param cache_name: The name of the Redis cache. Required. :type cache_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either OperationStatusResult or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.redis.models.OperationStatusResult] @@ -2376,7 +2181,7 @@ def get_long_running_output(pipeline_response): deserialized = self._deserialize("OperationStatusResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized if polling is True: @@ -2388,14 +2193,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.OperationStatusResult].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_flush_cache.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/flush" - } + return LROPoller[_models.OperationStatusResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_create_update.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_create_update.py index 218b7c62e4e1..1fe9c01b5de8 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_create_update.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_create_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_delete.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_delete.py index dd23d2ab3da1..e62569606c56 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_delete.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_get.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_get.py index c9a09adda80e..4b2665429b34 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_get.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_list.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_list.py index 796744f55a0e..e698f1218bd1 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_list.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_assignment_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_create_update.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_create_update.py index d0a82071baea..acb9d89d9552 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_create_update.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_create_update.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_delete.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_delete.py index 927a2d54bc10..c8cfc56939f7 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_delete.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_get.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_get.py index 7dde43122105..a28880f683a7 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_get.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_list.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_list.py index aec8f2f03fa6..cf6a421d6168 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_list.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_access_policy_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 3d1a33446740..77b94c6c4696 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 d4d264280dc6..74620de7301e 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 d8925c0b6a7a..6cb593661bbc 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 fe95c8995465..593ccf40484e 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 d64403a14dbc..1ada0645728c 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 a61a205b2683..6cf6b77c1807 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 1a7635473e17..4541cad5d009 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 f69be520fa88..245d50daff49 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 bc579277beb5..42b0c4cdc82a 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 8c2e2983b042..ccb899fae2e8 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 241ea6a9289e..03cba9eb4439 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 7deffb162b35..e46e4550a445 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_flush.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_flush.py index cc6daf28e43f..1371741aeaff 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_flush.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_flush.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 94d01845fed9..8c534dcfe7d9 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 5d30751bd966..1e7dd37045fc 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 d957874d3cc4..67fd1e17fa86 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 3f70d3e50375..62df542fb113 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_create.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_create.py index e162afef28ee..d7b1f2d714ef 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_create.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_create.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_delete.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_delete.py index a820b10b3bd4..f3f0f20332ea 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_delete.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_delete.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_get.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_get.py index 9349f7b8fd4c..739b7744ed00 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_get.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_get.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_list.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_list.py index 815f6c9c12ca..74e1d75032c5 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_list.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_linked_server_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 87de5a2d8c49..a94be57facbc 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 d2b160a5c3c3..2d119d2e0536 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 423179ef626e..f16db0d99382 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connections.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connections.py index f347ec976ac5..1579d0226342 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connections.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_endpoint_connections.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_link_resources.py b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_link_resources.py index 530e1411b85e..fc9de6416525 100644 --- a/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_link_resources.py +++ b/sdk/redis/azure-mgmt-redis/generated_samples/redis_cache_list_private_link_resources.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 df75f6499f48..6092585f99e3 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 a3dbb051830c..3888f0905d8c 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 6b1561a23004..6b9c4ac792e4 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 @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity 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 0456374e39ee..f3762bc9fa42 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 @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity 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 733da0c1d244..bd309c4ba796 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 @@ -6,9 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import TYPE_CHECKING, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from .. import models as _models """ # PREREQUISITES pip install azure-identity 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 ae98677ff55d..57eda115b8f2 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 a569a5fa7831..f6677246d57c 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 6ab6d8e0d89f..fae37e681aee 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ 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 2e0497b0a8ee..b5724ba8194e 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 @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.redis import RedisManagementClient """ diff --git a/sdk/redis/azure-mgmt-redis/setup.py b/sdk/redis/azure-mgmt-redis/setup.py index f0e70f322ef0..d365e0297fbd 100644 --- a/sdk/redis/azure-mgmt-redis/setup.py +++ b/sdk/redis/azure-mgmt-redis/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )