diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/_meta.json b/sdk/redisenterprise/azure-mgmt-redisenterprise/_meta.json index 1adfa3cd90e5..518f7e402bcc 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/_meta.json +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/_meta.json @@ -1,11 +1,11 @@ { - "commit": "8a287afb3721dee0d88f11502ec123470bc52a28", + "commit": "48f5ef8b12db91368ebffaf4a3aac82519cf9e35", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.19.0", + "@autorest/python@6.27.4", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/redisenterprise/resource-manager/readme.md --generate-sample=True --generate-test=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.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/redisenterprise/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/redisenterprise/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/__init__.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/__init__.py index 2938a541e82d..c9081688fd60 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/__init__.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._redis_enterprise_management_client import RedisEnterpriseManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._redis_enterprise_management_client import RedisEnterpriseManagementClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "RedisEnterpriseManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_configuration.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_configuration.py index 0d7dc327ee5f..c3befe4d417e 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_configuration.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_configuration.py @@ -14,7 +14,6 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential @@ -28,13 +27,13 @@ class RedisEnterpriseManagementClientConfiguration: # pylint: disable=too-many- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-09-01-preview") + api_version: str = kwargs.pop("api_version", "2025-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_redis_enterprise_management_client.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_redis_enterprise_management_client.py index c88c90e15cbe..ef62142ad375 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_redis_enterprise_management_client.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_redis_enterprise_management_client.py @@ -19,7 +19,6 @@ from ._configuration import RedisEnterpriseManagementClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( - AccessPolicyAssignmentOperations, DatabasesOperations, Operations, OperationsStatusOperations, @@ -29,11 +28,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class RedisEnterpriseManagementClient: """REST API for managing Redis Enterprise resources in Azure. :ivar operations: Operations operations @@ -44,9 +42,6 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver :vartype redis_enterprise: azure.mgmt.redisenterprise.operations.RedisEnterpriseOperations :ivar databases: DatabasesOperations operations :vartype databases: azure.mgmt.redisenterprise.operations.DatabasesOperations - :ivar access_policy_assignment: AccessPolicyAssignmentOperations operations - :vartype access_policy_assignment: - azure.mgmt.redisenterprise.operations.AccessPolicyAssignmentOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.redisenterprise.operations.PrivateEndpointConnectionsOperations @@ -59,8 +54,8 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -108,9 +103,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) - self.access_policy_assignment = AccessPolicyAssignmentOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_serialization.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_serialization.py index 8139854b97bb..b24ab2885450 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_serialization.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_serialization.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # # Copyright (c) Microsoft Corporation. All rights reserved. @@ -24,7 +25,6 @@ # # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -52,7 +52,6 @@ MutableMapping, Type, List, - Mapping, ) try: @@ -91,6 +90,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +113,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -155,6 +156,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -184,15 +190,30 @@ class UTC(datetime.tzinfo): """Time Zone info for handling UTC""" def utcoffset(self, dt): - """UTF offset for UTC is 0.""" + """UTF offset for UTC is 0. + + :param datetime.datetime dt: The datetime + :returns: The offset + :rtype: datetime.timedelta + """ return datetime.timedelta(0) def tzname(self, dt): - """Timestamp representation.""" + """Timestamp representation. + + :param datetime.datetime dt: The datetime + :returns: The timestamp representation + :rtype: str + """ return "Z" def dst(self, dt): - """No daylight saving for UTC.""" + """No daylight saving for UTC. + + :param datetime.datetime dt: The datetime + :returns: The daylight saving time + :rtype: datetime.timedelta + """ return datetime.timedelta(hours=1) @@ -206,7 +227,7 @@ class _FixedOffset(datetime.tzinfo): # type: ignore :param datetime.timedelta offset: offset in timedelta format """ - def __init__(self, offset): + def __init__(self, offset) -> None: self.__offset = offset def utcoffset(self, dt): @@ -235,24 +256,26 @@ def __getinitargs__(self): _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -300,13 +330,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -326,7 +366,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -346,7 +390,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -380,12 +426,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -395,7 +444,7 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @@ -408,6 +457,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @@ -426,9 +476,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model :raises: DeserializationError if something went wrong + :rtype: ModelType """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -448,21 +500,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -501,11 +557,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -540,7 +598,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -560,13 +618,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict :raises: SerializationError if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -592,12 +653,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -633,7 +696,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -664,17 +728,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict :raises: SerializationError if serialization fails. :raises: ValueError if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -703,7 +767,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -712,9 +776,11 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str + :returns: The serialized URL path :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -728,21 +794,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -759,19 +824,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str :raises: TypeError if serialization fails. :raises: ValueError if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -780,21 +846,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None :raises: AttributeError if required data is None. :raises: ValueError if data is None :raises: SerializationError if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -805,7 +870,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -821,11 +886,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -841,23 +905,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -871,8 +938,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -882,15 +948,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -945,9 +1009,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -971,7 +1034,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -979,6 +1042,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1003,7 +1067,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1034,56 +1098,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1091,11 +1160,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1105,30 +1175,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: TypeError if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1141,12 +1213,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str :raises: SerializationError if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1172,13 +1245,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int :raises: SerializationError if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1186,11 +1260,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1211,7 +1285,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1232,17 +1308,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1279,7 +1367,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1331,22 +1419,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1354,7 +1441,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1363,9 +1450,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1403,11 +1490,12 @@ def __call__(self, target_obj, response_data, content_type=None): :param str content_type: Swagger "produces" if available. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree @@ -1416,12 +1504,13 @@ def _deserialize(self, target_obj, data): :param object data: Object to deserialize. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1440,13 +1529,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1476,9 +1565,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1505,6 +1593,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1516,7 +1606,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1531,10 +1621,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1552,10 +1644,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1579,24 +1673,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1605,15 +1710,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. :raises: DeserializationError if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1627,7 +1733,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1647,14 +1757,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1671,6 +1781,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1681,11 +1792,12 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict :raises: TypeError if non-builtin datatype encountered. """ @@ -1720,11 +1832,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1732,6 +1843,7 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool :raises: TypeError if string format is not valid. """ @@ -1743,24 +1855,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1768,6 +1879,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1781,8 +1893,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1794,6 +1905,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1804,9 +1916,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1822,6 +1934,7 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1834,6 +1947,7 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray :raises: TypeError if string format invalid. """ @@ -1849,8 +1963,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal + :return: Deserialized decimal :raises: DeserializationError if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1865,6 +1980,7 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int :raises: ValueError if string format invalid. """ @@ -1877,6 +1993,7 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta :raises: DeserializationError if string format invalid. """ @@ -1887,14 +2004,14 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date :raises: DeserializationError if string format invalid. """ @@ -1910,6 +2027,7 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time :raises: DeserializationError if string format invalid. """ @@ -1924,6 +2042,7 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1939,14 +2058,14 @@ def deserialize_rfc(attr): except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime :raises: DeserializationError if string format invalid. """ @@ -1976,8 +2095,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1985,6 +2103,7 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime :raises: DeserializationError if format invalid """ @@ -1996,5 +2115,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_version.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_version.py index d5129bebc550..48944bf3938a 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_version.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "3.1.0b2" +VERSION = "2.0.0" diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/__init__.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/__init__.py index 4b06cecba2f9..190dbf01f5ab 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/__init__.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._redis_enterprise_management_client import RedisEnterpriseManagementClient +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._redis_enterprise_management_client import RedisEnterpriseManagementClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "RedisEnterpriseManagementClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_configuration.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_configuration.py index 2f7ead7a27c9..c512e752a4d3 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_configuration.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_configuration.py @@ -14,7 +14,6 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential @@ -28,13 +27,13 @@ class RedisEnterpriseManagementClientConfiguration: # pylint: disable=too-many- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-09-01-preview") + api_version: str = kwargs.pop("api_version", "2025-04-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_redis_enterprise_management_client.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_redis_enterprise_management_client.py index c287b5e691b8..46b71587acdf 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_redis_enterprise_management_client.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/_redis_enterprise_management_client.py @@ -19,7 +19,6 @@ from .._serialization import Deserializer, Serializer from ._configuration import RedisEnterpriseManagementClientConfiguration from .operations import ( - AccessPolicyAssignmentOperations, DatabasesOperations, Operations, OperationsStatusOperations, @@ -29,11 +28,10 @@ ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class RedisEnterpriseManagementClient: """REST API for managing Redis Enterprise resources in Azure. :ivar operations: Operations operations @@ -45,9 +43,6 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver :vartype redis_enterprise: azure.mgmt.redisenterprise.aio.operations.RedisEnterpriseOperations :ivar databases: DatabasesOperations operations :vartype databases: azure.mgmt.redisenterprise.aio.operations.DatabasesOperations - :ivar access_policy_assignment: AccessPolicyAssignmentOperations operations - :vartype access_policy_assignment: - azure.mgmt.redisenterprise.aio.operations.AccessPolicyAssignmentOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.redisenterprise.aio.operations.PrivateEndpointConnectionsOperations @@ -60,8 +55,8 @@ class RedisEnterpriseManagementClient: # pylint: disable=client-accepts-api-ver :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2025-04-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -109,9 +104,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.databases = DatabasesOperations(self._client, self._config, self._serialize, self._deserialize) - self.access_policy_assignment = AccessPolicyAssignmentOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/__init__.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/__init__.py index 663e4bdcb58e..bb6c16197a30 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/__init__.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/__init__.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._operations_status_operations import OperationsStatusOperations -from ._redis_enterprise_operations import RedisEnterpriseOperations -from ._databases_operations import DatabasesOperations -from ._access_policy_assignment_operations import AccessPolicyAssignmentOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations_status_operations import OperationsStatusOperations # type: ignore +from ._redis_enterprise_operations import RedisEnterpriseOperations # type: ignore +from ._databases_operations import DatabasesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -23,9 +28,8 @@ "OperationsStatusOperations", "RedisEnterpriseOperations", "DatabasesOperations", - "AccessPolicyAssignmentOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_access_policy_assignment_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_access_policy_assignment_operations.py deleted file mode 100644 index 772fee8fcd16..000000000000 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_access_policy_assignment_operations.py +++ /dev/null @@ -1,589 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._access_policy_assignment_operations import ( - build_create_update_request, - build_delete_request, - build_get_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AccessPolicyAssignmentOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redisenterprise.aio.RedisEnterpriseManagementClient`'s - :attr:`access_policy_assignment` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _create_update_initial( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - parameters: Union[_models.AccessPolicyAssignment, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AccessPolicyAssignment") - - _request = build_create_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - parameters: _models.AccessPolicyAssignment, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessPolicyAssignment]: - """Creates/Updates a particular access policy assignment for a database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :param parameters: Parameters supplied to the create access policy assignment for database. - Required. - :type parameters: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AccessPolicyAssignment or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessPolicyAssignment]: - """Creates/Updates a particular access policy assignment for a database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :param parameters: Parameters supplied to the create access policy assignment for database. - Required. - :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 - :return: An instance of AsyncLROPoller that returns either AccessPolicyAssignment or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - parameters: Union[_models.AccessPolicyAssignment, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.AccessPolicyAssignment]: - """Creates/Updates a particular access policy assignment for a database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :param parameters: Parameters supplied to the create access policy assignment for database. Is - either a AccessPolicyAssignment type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AccessPolicyAssignment or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessPolicyAssignment] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessPolicyAssignment", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AccessPolicyAssignment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AccessPolicyAssignment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - **kwargs: Any - ) -> _models.AccessPolicyAssignment: - """Gets information about access policy assignment for database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :return: AccessPolicyAssignment or the result of cls(response) - :rtype: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AccessPolicyAssignment] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccessPolicyAssignment", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a single access policy assignment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AccessPolicyAssignment"]: - """Gets all access policy assignments.. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :return: An iterator like instance of either AccessPolicyAssignment or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AccessPolicyAssignmentList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AccessPolicyAssignmentList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_databases_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_databases_operations.py index d6c3d971e191..805192f809dd 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_databases_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_databases_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -45,13 +45,12 @@ build_list_keys_request, build_regenerate_key_request, build_update_request, - build_upgrade_db_redis_version_request, ) if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,12 +78,14 @@ def __init__(self, *args, **kwargs) -> None: def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.Database"]: - """Gets all databases in the specified Redis Enterprise cluster. + """Gets all databases in the specified RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: An iterator like instance of either Database or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redisenterprise.models.Database] @@ -96,7 +97,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -167,7 +168,7 @@ async def _create_initial( parameters: Union[_models.Database, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -244,7 +245,9 @@ async def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -275,7 +278,9 @@ async def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -304,7 +309,9 @@ async def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -375,7 +382,7 @@ async def _update_initial( parameters: Union[_models.DatabaseUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -459,7 +466,9 @@ async def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -490,7 +499,9 @@ async def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -519,7 +530,9 @@ async def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -586,12 +599,14 @@ def get_long_running_output(pipeline_response): async def get( self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any ) -> _models.Database: - """Gets information about a database in a Redis Enterprise cluster. + """Gets information about a database in a RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -599,7 +614,7 @@ async def get( :rtype: ~azure.mgmt.redisenterprise.models.Database :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -646,7 +661,7 @@ async def get( async def _delete_initial( self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -711,7 +726,9 @@ async def begin_delete( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -767,12 +784,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- async def list_keys( self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any ) -> _models.AccessKeys: - """Retrieves the access keys for the Redis Enterprise database. + """Retrieves the access keys for the RedisEnterprise database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -780,7 +799,7 @@ async def list_keys( :rtype: ~azure.mgmt.redisenterprise.models.AccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -832,7 +851,7 @@ async def _regenerate_key_initial( parameters: Union[_models.RegenerateKeyParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -911,12 +930,14 @@ async def begin_regenerate_key( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AccessKeys]: - """Regenerates the Redis Enterprise database's access keys. + """Regenerates the RedisEnterprise database's access keys. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -942,12 +963,14 @@ async def begin_regenerate_key( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.AccessKeys]: - """Regenerates the Redis Enterprise database's access keys. + """Regenerates the RedisEnterprise database's access keys. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -971,12 +994,14 @@ async def begin_regenerate_key( parameters: Union[_models.RegenerateKeyParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.AccessKeys]: - """Regenerates the Redis Enterprise database's access keys. + """Regenerates the RedisEnterprise database's access keys. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1047,7 +1072,7 @@ async def _import_method_initial( parameters: Union[_models.ImportClusterParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1131,7 +1156,9 @@ async def begin_import_method( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1161,7 +1188,9 @@ async def begin_import_method( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1189,7 +1218,9 @@ async def begin_import_method( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1255,7 +1286,7 @@ async def _export_initial( parameters: Union[_models.ExportClusterParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1339,7 +1370,9 @@ async def begin_export( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1369,7 +1402,9 @@ async def begin_export( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1397,7 +1432,9 @@ async def begin_export( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1463,7 +1500,7 @@ async def _force_unlink_initial( parameters: Union[_models.ForceUnlinkParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1547,7 +1584,9 @@ async def begin_force_unlink( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1577,7 +1616,9 @@ async def begin_force_unlink( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1605,7 +1646,9 @@ async def begin_force_unlink( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1671,7 +1714,7 @@ async def _force_link_to_replication_group_initial( parameters: Union[_models.ForceLinkParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1722,7 +1765,7 @@ async def _force_link_to_replication_group_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -1756,7 +1799,9 @@ async def begin_force_link_to_replication_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1788,7 +1833,9 @@ async def begin_force_link_to_replication_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1818,7 +1865,9 @@ async def begin_force_link_to_replication_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1884,7 +1933,7 @@ async def _flush_initial( parameters: Union[_models.FlushParameters, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1968,7 +2017,9 @@ async def begin_flush( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1998,7 +2049,9 @@ async def begin_flush( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2026,7 +2079,9 @@ async def begin_flush( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2082,121 +2137,3 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- deserialization_callback=get_long_running_output, ) return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _upgrade_db_redis_version_initial( - self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_upgrade_db_redis_version_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_upgrade_db_redis_version( - self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Upgrades the database Redis version to the latest available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._upgrade_db_redis_version_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations.py index daf642321434..194666210faa 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,7 +68,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations_status_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations_status_operations.py index e3632908b7c3..9e3c2da7c506 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations_status_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_operations_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,7 +28,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,7 +64,7 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. :rtype: ~azure.mgmt.redisenterprise.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_endpoint_connections_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_endpoint_connections_operations.py index 132bae146416..cf0c709ee8a9 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -42,7 +41,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,12 +69,14 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.PrivateEndpointConnection"]: - """Lists all the private endpoint connections associated with the Redis Enterprise cluster. + """Lists all the private endpoint connections associated with the RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) @@ -89,7 +90,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -156,12 +157,14 @@ async def get_next(next_link=None): async def get( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the Redis Enterprise cluster. + """Gets the specified private endpoint connection associated with the RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. @@ -170,7 +173,7 @@ async def get( :rtype: ~azure.mgmt.redisenterprise.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -222,7 +225,7 @@ async def _put_initial( properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,13 +297,15 @@ async def begin_put( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Updates the state of the specified private endpoint connection associated with the Redis - Enterprise cluster. + """Updates the state of the specified private endpoint connection associated with the + RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. @@ -328,13 +333,15 @@ async def begin_put( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Updates the state of the specified private endpoint connection associated with the Redis - Enterprise cluster. + """Updates the state of the specified private endpoint connection associated with the + RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. @@ -360,13 +367,15 @@ async def begin_put( properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Updates the state of the specified private endpoint connection associated with the Redis - Enterprise cluster. + """Updates the state of the specified private endpoint connection associated with the + RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. @@ -431,7 +440,7 @@ def get_long_running_output(pipeline_response): async def _delete_initial( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -491,12 +500,14 @@ async def _delete_initial( async def begin_delete( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> AsyncLROPoller[None]: - """Deletes the specified private endpoint connection associated with the Redis Enterprise cluster. + """Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_link_resources_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_link_resources_operations.py index 6ff0baeb8b34..b8979e8dc66b 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_link_resources_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,12 +58,14 @@ def __init__(self, *args, **kwargs) -> None: def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> AsyncIterable["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a Redis Enterprise cluster. + """Gets the private link resources that need to be created for a RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: @@ -77,7 +78,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_redis_enterprise_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_redis_enterprise_operations.py index 2f30cc7ad0e5..1649d231ad4c 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_redis_enterprise_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/aio/operations/_redis_enterprise_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -44,7 +43,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,7 +70,7 @@ def __init__(self, *args, **kwargs) -> None: async def _create_initial( self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,9 +145,11 @@ async def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Create Redis Enterprise operation. Required. + :param parameters: Parameters supplied to the Create RedisEnterprise operation. Required. :type parameters: ~azure.mgmt.redisenterprise.models.Cluster :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -174,9 +175,11 @@ async def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Create Redis Enterprise operation. Required. + :param parameters: Parameters supplied to the Create RedisEnterprise operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -196,9 +199,11 @@ async def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Create Redis Enterprise operation. Is either a + :param parameters: Parameters supplied to the Create RedisEnterprise operation. Is either a Cluster type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.redisenterprise.models.Cluster or IO[bytes] :return: An instance of AsyncLROPoller that returns either Cluster or the result of @@ -263,7 +268,7 @@ async def _update_initial( parameters: Union[_models.ClusterUpdate, IO[bytes]], **kwargs: Any ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -340,14 +345,16 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Updates an existing Redis Enterprise cluster. + """Updates an existing RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Update Redis Enterprise operation. Required. + :param parameters: Parameters supplied to the Update RedisEnterprise operation. Required. :type parameters: ~azure.mgmt.redisenterprise.models.ClusterUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -368,14 +375,16 @@ async def begin_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Updates an existing Redis Enterprise cluster. + """Updates an existing RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Update Redis Enterprise operation. Required. + :param parameters: Parameters supplied to the Update RedisEnterprise operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -394,14 +403,16 @@ async def begin_update( parameters: Union[_models.ClusterUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Cluster]: - """Updates an existing Redis Enterprise cluster. + """Updates an existing RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Update Redis Enterprise operation. Is either a + :param parameters: Parameters supplied to the Update RedisEnterprise operation. Is either a ClusterUpdate type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.redisenterprise.models.ClusterUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either Cluster or the result of @@ -460,7 +471,7 @@ def get_long_running_output(pipeline_response): ) async def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -517,12 +528,14 @@ async def _delete_initial(self, resource_group_name: str, cluster_name: str, **k @distributed_trace_async async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a Redis Enterprise cache cluster. + """Deletes a RedisEnterprise cache cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] @@ -573,18 +586,20 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace_async async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster: - """Gets information about a Redis Enterprise cluster. + """Gets information about a RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.redisenterprise.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -629,7 +644,7 @@ async def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: - """Lists all Redis Enterprise clusters in a resource group. + """Lists all RedisEnterprise clusters in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -644,7 +659,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -708,7 +723,7 @@ async def get_next(next_link=None): @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: - """Lists all Redis Enterprise clusters in the specified subscription. + """Gets all RedisEnterprise clusters in the specified subscription. :return: An iterator like instance of either Cluster or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.redisenterprise.models.Cluster] @@ -720,7 +735,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Cluster"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/__init__.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/__init__.py index e9a168c77e6a..1857eb589cb7 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/__init__.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/__init__.py @@ -5,84 +5,84 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import AccessKeys -from ._models_py3 import AccessPolicyAssignment -from ._models_py3 import AccessPolicyAssignmentList -from ._models_py3 import AccessPolicyAssignmentPropertiesUser -from ._models_py3 import Cluster -from ._models_py3 import ClusterList -from ._models_py3 import ClusterPropertiesEncryption -from ._models_py3 import ClusterPropertiesEncryptionCustomerManagedKeyEncryption -from ._models_py3 import ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity -from ._models_py3 import ClusterUpdate -from ._models_py3 import Database -from ._models_py3 import DatabaseList -from ._models_py3 import DatabasePropertiesGeoReplication -from ._models_py3 import DatabaseUpdate -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import ExportClusterParameters -from ._models_py3 import FlushParameters -from ._models_py3 import ForceLinkParameters -from ._models_py3 import ForceUnlinkParameters -from ._models_py3 import ImportClusterParameters -from ._models_py3 import LinkedDatabase -from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import Module -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import OperationStatus -from ._models_py3 import Persistence -from ._models_py3 import PrivateEndpoint -from ._models_py3 import PrivateEndpointConnection -from ._models_py3 import PrivateEndpointConnectionListResult -from ._models_py3 import PrivateLinkResource -from ._models_py3 import PrivateLinkResourceListResult -from ._models_py3 import PrivateLinkServiceConnectionState -from ._models_py3 import ProxyResource -from ._models_py3 import ProxyResourceAutoGenerated -from ._models_py3 import RegenerateKeyParameters -from ._models_py3 import Resource -from ._models_py3 import ResourceAutoGenerated -from ._models_py3 import Sku -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import UserAssignedIdentity +from typing import TYPE_CHECKING -from ._redis_enterprise_management_client_enums import AccessKeyType -from ._redis_enterprise_management_client_enums import AccessKeysAuthentication -from ._redis_enterprise_management_client_enums import ActionType -from ._redis_enterprise_management_client_enums import AofFrequency -from ._redis_enterprise_management_client_enums import ClusteringPolicy -from ._redis_enterprise_management_client_enums import CmkIdentityType -from ._redis_enterprise_management_client_enums import CreatedByType -from ._redis_enterprise_management_client_enums import DeferUpgradeSetting -from ._redis_enterprise_management_client_enums import EvictionPolicy -from ._redis_enterprise_management_client_enums import HighAvailability -from ._redis_enterprise_management_client_enums import LinkState -from ._redis_enterprise_management_client_enums import ManagedServiceIdentityType -from ._redis_enterprise_management_client_enums import Origin -from ._redis_enterprise_management_client_enums import PrivateEndpointConnectionProvisioningState -from ._redis_enterprise_management_client_enums import PrivateEndpointServiceConnectionStatus -from ._redis_enterprise_management_client_enums import Protocol -from ._redis_enterprise_management_client_enums import ProvisioningState -from ._redis_enterprise_management_client_enums import RdbFrequency -from ._redis_enterprise_management_client_enums import RedundancyMode -from ._redis_enterprise_management_client_enums import ResourceState -from ._redis_enterprise_management_client_enums import SkuName -from ._redis_enterprise_management_client_enums import TlsVersion +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + AccessKeys, + Cluster, + ClusterList, + ClusterPropertiesEncryption, + ClusterPropertiesEncryptionCustomerManagedKeyEncryption, + ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity, + ClusterUpdate, + Database, + DatabaseList, + DatabasePropertiesGeoReplication, + DatabaseUpdate, + ErrorAdditionalInfo, + ErrorDetail, + ErrorDetailAutoGenerated, + ErrorResponse, + ErrorResponseAutoGenerated, + ExportClusterParameters, + FlushParameters, + ForceLinkParameters, + ForceLinkParametersGeoReplication, + ForceUnlinkParameters, + ImportClusterParameters, + LinkedDatabase, + ManagedServiceIdentity, + Module, + Operation, + OperationDisplay, + OperationListResult, + OperationStatus, + Persistence, + PrivateEndpoint, + PrivateEndpointConnection, + PrivateEndpointConnectionListResult, + PrivateLinkResource, + PrivateLinkResourceListResult, + PrivateLinkServiceConnectionState, + ProxyResource, + RegenerateKeyParameters, + Resource, + Sku, + TrackedResource, + UserAssignedIdentity, +) + +from ._redis_enterprise_management_client_enums import ( # type: ignore + AccessKeyType, + ActionType, + AofFrequency, + ClusteringPolicy, + CmkIdentityType, + EvictionPolicy, + LinkState, + ManagedServiceIdentityType, + Origin, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + Protocol, + ProvisioningState, + RdbFrequency, + ResourceState, + SkuName, + TlsVersion, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "AccessKeys", - "AccessPolicyAssignment", - "AccessPolicyAssignmentList", - "AccessPolicyAssignmentPropertiesUser", "Cluster", "ClusterList", "ClusterPropertiesEncryption", @@ -95,10 +95,13 @@ "DatabaseUpdate", "ErrorAdditionalInfo", "ErrorDetail", + "ErrorDetailAutoGenerated", "ErrorResponse", + "ErrorResponseAutoGenerated", "ExportClusterParameters", "FlushParameters", "ForceLinkParameters", + "ForceLinkParametersGeoReplication", "ForceUnlinkParameters", "ImportClusterParameters", "LinkedDatabase", @@ -116,24 +119,17 @@ "PrivateLinkResourceListResult", "PrivateLinkServiceConnectionState", "ProxyResource", - "ProxyResourceAutoGenerated", "RegenerateKeyParameters", "Resource", - "ResourceAutoGenerated", "Sku", - "SystemData", "TrackedResource", "UserAssignedIdentity", "AccessKeyType", - "AccessKeysAuthentication", "ActionType", "AofFrequency", "ClusteringPolicy", "CmkIdentityType", - "CreatedByType", - "DeferUpgradeSetting", "EvictionPolicy", - "HighAvailability", "LinkState", "ManagedServiceIdentityType", "Origin", @@ -142,10 +138,9 @@ "Protocol", "ProvisioningState", "RdbFrequency", - "RedundancyMode", "ResourceState", "SkuName", "TlsVersion", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_models_py3.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_models_py3.py index 25ec1a9de38a..1de6e8fedd88 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_models_py3.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_models_py3.py @@ -1,5 +1,5 @@ -# coding=utf-8 # pylint: disable=too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -7,13 +7,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -80,133 +78,6 @@ def __init__(self, **kwargs: Any) -> None: self.type = None -class ProxyResourceAutoGenerated(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - -class AccessPolicyAssignment(ProxyResourceAutoGenerated): - """Describes the access policy assignment of Redis Enterprise database. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar provisioning_state: Current provisioning status of the access policy assignment. Known - values are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState - :ivar access_policy_name: Name of access policy under specific access policy assignment. Only - "default" policy is supported for now. - :vartype access_policy_name: str - :ivar user: The user associated with the access policy. - :vartype user: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignmentPropertiesUser - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "access_policy_name": {"pattern": r"^([a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]|[a-zA-Z0-9])$"}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "access_policy_name": {"key": "properties.accessPolicyName", "type": "str"}, - "user": {"key": "properties.user", "type": "AccessPolicyAssignmentPropertiesUser"}, - } - - def __init__( - self, - *, - access_policy_name: Optional[str] = None, - user: Optional["_models.AccessPolicyAssignmentPropertiesUser"] = None, - **kwargs: Any - ) -> None: - """ - :keyword access_policy_name: Name of access policy under specific access policy assignment. - Only "default" policy is supported for now. - :paramtype access_policy_name: str - :keyword user: The user associated with the access policy. - :paramtype user: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignmentPropertiesUser - """ - super().__init__(**kwargs) - self.provisioning_state = None - self.access_policy_name = access_policy_name - self.user = user - - -class AccessPolicyAssignmentList(_serialization.Model): - """The response of a list-all operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of access policy assignments. - :vartype value: list[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :ivar next_link: The URI to fetch the next page of results. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AccessPolicyAssignment]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.AccessPolicyAssignment"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of access policy assignments. - :paramtype value: list[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class AccessPolicyAssignmentPropertiesUser(_serialization.Model): - """The user associated with the access policy. - - :ivar object_id: The object ID of the user. - :vartype object_id: str - """ - - _attribute_map = { - "object_id": {"key": "objectId", "type": "str"}, - } - - def __init__(self, *, object_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword object_id: The object ID of the user. - :paramtype object_id: str - """ - super().__init__(**kwargs) - self.object_id = object_id - - class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -256,8 +127,8 @@ def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kw self.location = location -class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes - """Describes the Redis Enterprise cluster. +class Cluster(TrackedResource): + """Describes the RedisEnterprise cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -281,14 +152,8 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :vartype zones: list[str] :ivar identity: The identity of the resource. :vartype identity: ~azure.mgmt.redisenterprise.models.ManagedServiceIdentity - :ivar high_availability: Enabled by default. If highAvailability is disabled, the data set is - not replicated. This affects the availability SLA, and increases the risk of data loss. Known - values are: "Enabled" and "Disabled". - :vartype high_availability: str or ~azure.mgmt.redisenterprise.models.HighAvailability :ivar minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. - Newer versions can be added in the future. Note that TLS 1.0 and TLS 1.1 are now completely - obsolete -- you cannot use them. They are mentioned only for the sake of consistency with old - API versions. Known values are: "1.0", "1.1", and "1.2". + Known values are: "1.0", "1.1", and "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redisenterprise.models.TlsVersion :ivar encryption: Encryption-at-rest configuration for the cluster. :vartype encryption: ~azure.mgmt.redisenterprise.models.ClusterPropertiesEncryption @@ -297,9 +162,6 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :ivar provisioning_state: Current provisioning status of the cluster. Known values are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState - :ivar redundancy_mode: Explains the current redundancy strategy of the cluster, which affects - the expected SLA. Known values are: "None", "LR", and "ZR". - :vartype redundancy_mode: str or ~azure.mgmt.redisenterprise.models.RedundancyMode :ivar resource_state: Current resource status of the cluster. Known values are: "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed". @@ -307,7 +169,7 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes :ivar redis_version: Version of redis the cluster supports, e.g. '6'. :vartype redis_version: str :ivar private_endpoint_connections: List of private endpoint connections associated with the - specified Redis Enterprise cluster. + specified RedisEnterprise cluster. :vartype private_endpoint_connections: list[~azure.mgmt.redisenterprise.models.PrivateEndpointConnection] """ @@ -320,7 +182,6 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "sku": {"required": True}, "host_name": {"readonly": True}, "provisioning_state": {"readonly": True}, - "redundancy_mode": {"readonly": True}, "resource_state": {"readonly": True}, "redis_version": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, @@ -335,12 +196,10 @@ class Cluster(TrackedResource): # pylint: disable=too-many-instance-attributes "sku": {"key": "sku", "type": "Sku"}, "zones": {"key": "zones", "type": "[str]"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "high_availability": {"key": "properties.highAvailability", "type": "str"}, "minimum_tls_version": {"key": "properties.minimumTlsVersion", "type": "str"}, "encryption": {"key": "properties.encryption", "type": "ClusterPropertiesEncryption"}, "host_name": {"key": "properties.hostName", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "redundancy_mode": {"key": "properties.redundancyMode", "type": "str"}, "resource_state": {"key": "properties.resourceState", "type": "str"}, "redis_version": {"key": "properties.redisVersion", "type": "str"}, "private_endpoint_connections": { @@ -357,7 +216,6 @@ def __init__( tags: Optional[Dict[str, str]] = None, zones: Optional[List[str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, - high_availability: Optional[Union[str, "_models.HighAvailability"]] = None, minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, encryption: Optional["_models.ClusterPropertiesEncryption"] = None, **kwargs: Any @@ -373,14 +231,8 @@ def __init__( :paramtype zones: list[str] :keyword identity: The identity of the resource. :paramtype identity: ~azure.mgmt.redisenterprise.models.ManagedServiceIdentity - :keyword high_availability: Enabled by default. If highAvailability is disabled, the data set - is not replicated. This affects the availability SLA, and increases the risk of data loss. - Known values are: "Enabled" and "Disabled". - :paramtype high_availability: str or ~azure.mgmt.redisenterprise.models.HighAvailability :keyword minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. - Newer versions can be added in the future. Note that TLS 1.0 and TLS 1.1 are now completely - obsolete -- you cannot use them. They are mentioned only for the sake of consistency with old - API versions. Known values are: "1.0", "1.1", and "1.2". + Known values are: "1.0", "1.1", and "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redisenterprise.models.TlsVersion :keyword encryption: Encryption-at-rest configuration for the cluster. :paramtype encryption: ~azure.mgmt.redisenterprise.models.ClusterPropertiesEncryption @@ -389,12 +241,10 @@ def __init__( self.sku = sku self.zones = zones self.identity = identity - self.high_availability = high_availability self.minimum_tls_version = minimum_tls_version self.encryption = encryption self.host_name = None self.provisioning_state = None - self.redundancy_mode = None self.resource_state = None self.redis_version = None self.private_endpoint_connections = None @@ -515,7 +365,7 @@ class ClusterPropertiesEncryptionCustomerManagedKeyEncryptionKeyIdentity( used to auth to Key Vault. :ivar user_assigned_identity_resource_id: User assigned identity to use for accessing key - encryption key Url. Ex: /subscriptions/:code:``/resourceGroups/:code:``/resourceGroups/\\ :code:``/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. :vartype user_assigned_identity_resource_id: str :ivar identity_type: Only userAssignedIdentity is supported in this API version; other types @@ -538,7 +388,7 @@ def __init__( ) -> None: """ :keyword user_assigned_identity_resource_id: User assigned identity to use for accessing key - encryption key Url. Ex: /subscriptions/:code:``/resourceGroups/:code:``/resourceGroups/\\ :code:``/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. :paramtype user_assigned_identity_resource_id: str :keyword identity_type: Only userAssignedIdentity is supported in this API version; other types @@ -551,8 +401,8 @@ def __init__( self.identity_type = identity_type -class ClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes - """A partial update to the Redis Enterprise cluster. +class ClusterUpdate(_serialization.Model): + """A partial update to the RedisEnterprise cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -562,14 +412,8 @@ class ClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance- :vartype identity: ~azure.mgmt.redisenterprise.models.ManagedServiceIdentity :ivar tags: Resource tags. :vartype tags: dict[str, str] - :ivar high_availability: Enabled by default. If highAvailability is disabled, the data set is - not replicated. This affects the availability SLA, and increases the risk of data loss. Known - values are: "Enabled" and "Disabled". - :vartype high_availability: str or ~azure.mgmt.redisenterprise.models.HighAvailability :ivar minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. - Newer versions can be added in the future. Note that TLS 1.0 and TLS 1.1 are now completely - obsolete -- you cannot use them. They are mentioned only for the sake of consistency with old - API versions. Known values are: "1.0", "1.1", and "1.2". + Known values are: "1.0", "1.1", and "1.2". :vartype minimum_tls_version: str or ~azure.mgmt.redisenterprise.models.TlsVersion :ivar encryption: Encryption-at-rest configuration for the cluster. :vartype encryption: ~azure.mgmt.redisenterprise.models.ClusterPropertiesEncryption @@ -578,9 +422,6 @@ class ClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance- :ivar provisioning_state: Current provisioning status of the cluster. Known values are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". :vartype provisioning_state: str or ~azure.mgmt.redisenterprise.models.ProvisioningState - :ivar redundancy_mode: Explains the current redundancy strategy of the cluster, which affects - the expected SLA. Known values are: "None", "LR", and "ZR". - :vartype redundancy_mode: str or ~azure.mgmt.redisenterprise.models.RedundancyMode :ivar resource_state: Current resource status of the cluster. Known values are: "Running", "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed". @@ -588,7 +429,7 @@ class ClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance- :ivar redis_version: Version of redis the cluster supports, e.g. '6'. :vartype redis_version: str :ivar private_endpoint_connections: List of private endpoint connections associated with the - specified Redis Enterprise cluster. + specified RedisEnterprise cluster. :vartype private_endpoint_connections: list[~azure.mgmt.redisenterprise.models.PrivateEndpointConnection] """ @@ -596,7 +437,6 @@ class ClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance- _validation = { "host_name": {"readonly": True}, "provisioning_state": {"readonly": True}, - "redundancy_mode": {"readonly": True}, "resource_state": {"readonly": True}, "redis_version": {"readonly": True}, "private_endpoint_connections": {"readonly": True}, @@ -606,12 +446,10 @@ class ClusterUpdate(_serialization.Model): # pylint: disable=too-many-instance- "sku": {"key": "sku", "type": "Sku"}, "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, "tags": {"key": "tags", "type": "{str}"}, - "high_availability": {"key": "properties.highAvailability", "type": "str"}, "minimum_tls_version": {"key": "properties.minimumTlsVersion", "type": "str"}, "encryption": {"key": "properties.encryption", "type": "ClusterPropertiesEncryption"}, "host_name": {"key": "properties.hostName", "type": "str"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "redundancy_mode": {"key": "properties.redundancyMode", "type": "str"}, "resource_state": {"key": "properties.resourceState", "type": "str"}, "redis_version": {"key": "properties.redisVersion", "type": "str"}, "private_endpoint_connections": { @@ -626,7 +464,6 @@ def __init__( sku: Optional["_models.Sku"] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, tags: Optional[Dict[str, str]] = None, - high_availability: Optional[Union[str, "_models.HighAvailability"]] = None, minimum_tls_version: Optional[Union[str, "_models.TlsVersion"]] = None, encryption: Optional["_models.ClusterPropertiesEncryption"] = None, **kwargs: Any @@ -638,14 +475,8 @@ def __init__( :paramtype identity: ~azure.mgmt.redisenterprise.models.ManagedServiceIdentity :keyword tags: Resource tags. :paramtype tags: dict[str, str] - :keyword high_availability: Enabled by default. If highAvailability is disabled, the data set - is not replicated. This affects the availability SLA, and increases the risk of data loss. - Known values are: "Enabled" and "Disabled". - :paramtype high_availability: str or ~azure.mgmt.redisenterprise.models.HighAvailability :keyword minimum_tls_version: The minimum TLS version for the cluster to support, e.g. '1.2'. - Newer versions can be added in the future. Note that TLS 1.0 and TLS 1.1 are now completely - obsolete -- you cannot use them. They are mentioned only for the sake of consistency with old - API versions. Known values are: "1.0", "1.1", and "1.2". + Known values are: "1.0", "1.1", and "1.2". :paramtype minimum_tls_version: str or ~azure.mgmt.redisenterprise.models.TlsVersion :keyword encryption: Encryption-at-rest configuration for the cluster. :paramtype encryption: ~azure.mgmt.redisenterprise.models.ClusterPropertiesEncryption @@ -654,59 +485,16 @@ def __init__( self.sku = sku self.identity = identity self.tags = tags - self.high_availability = high_availability self.minimum_tls_version = minimum_tls_version self.encryption = encryption self.host_name = None self.provisioning_state = None - self.redundancy_mode = None self.resource_state = None self.redis_version = None self.private_endpoint_connections = None -class ResourceAutoGenerated(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.redisenterprise.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(ResourceAutoGenerated): +class ProxyResource(Resource): """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. @@ -720,14 +508,11 @@ class ProxyResource(ResourceAutoGenerated): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.redisenterprise.models.SystemData """ -class Database(ProxyResource): # pylint: disable=too-many-instance-attributes - """Describes a database on the Redis Enterprise cluster. +class Database(ProxyResource): + """Describes a database on the RedisEnterprise cluster. Variables are only populated by the server, and will be ignored when sending a request. @@ -739,9 +524,6 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.redisenterprise.models.SystemData :ivar client_protocol: Specifies whether redis clients can connect using TLS-encrypted or plaintext redis protocols. Default is TLS-encrypted. Known values are: "Encrypted" and "Plaintext". @@ -756,9 +538,8 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed". :vartype resource_state: str or ~azure.mgmt.redisenterprise.models.ResourceState - :ivar clustering_policy: Clustering policy - default is OSSCluster. This property must be - chosen at create time, and cannot be changed without deleting the database. Known values are: - "EnterpriseCluster" and "OSSCluster". + :ivar clustering_policy: Clustering policy - default is OSSCluster. Specified at create time. + Known values are: "EnterpriseCluster" and "OSSCluster". :vartype clustering_policy: str or ~azure.mgmt.redisenterprise.models.ClusteringPolicy :ivar eviction_policy: Redis eviction policy - default is VolatileLRU. Known values are: "AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", "VolatileTTL", @@ -772,34 +553,20 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes :ivar geo_replication: Optional set of properties to configure geo replication for this database. :vartype geo_replication: ~azure.mgmt.redisenterprise.models.DatabasePropertiesGeoReplication - :ivar redis_version: Version of Redis the database is running on, e.g. '6.0'. - :vartype redis_version: str - :ivar defer_upgrade: Option to defer upgrade when newest version is released - default is - NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and - "NotDeferred". - :vartype defer_upgrade: str or ~azure.mgmt.redisenterprise.models.DeferUpgradeSetting - :ivar access_keys_authentication: This property can be Enabled/Disabled to allow or deny access - with the current access keys. Can be updated even after database is created. Known values are: - "Disabled" and "Enabled". - :vartype access_keys_authentication: str or - ~azure.mgmt.redisenterprise.models.AccessKeysAuthentication """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "system_data": {"readonly": True}, "provisioning_state": {"readonly": True}, "resource_state": {"readonly": True}, - "redis_version": {"readonly": True}, } _attribute_map = { "id": {"key": "id", "type": "str"}, "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, "client_protocol": {"key": "properties.clientProtocol", "type": "str"}, "port": {"key": "properties.port", "type": "int"}, "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, @@ -809,9 +576,6 @@ class Database(ProxyResource): # pylint: disable=too-many-instance-attributes "persistence": {"key": "properties.persistence", "type": "Persistence"}, "modules": {"key": "properties.modules", "type": "[Module]"}, "geo_replication": {"key": "properties.geoReplication", "type": "DatabasePropertiesGeoReplication"}, - "redis_version": {"key": "properties.redisVersion", "type": "str"}, - "defer_upgrade": {"key": "properties.deferUpgrade", "type": "str"}, - "access_keys_authentication": {"key": "properties.accessKeysAuthentication", "type": "str"}, } def __init__( @@ -824,8 +588,6 @@ def __init__( persistence: Optional["_models.Persistence"] = None, modules: Optional[List["_models.Module"]] = None, geo_replication: Optional["_models.DatabasePropertiesGeoReplication"] = None, - defer_upgrade: Optional[Union[str, "_models.DeferUpgradeSetting"]] = None, - access_keys_authentication: Optional[Union[str, "_models.AccessKeysAuthentication"]] = None, **kwargs: Any ) -> None: """ @@ -836,9 +598,8 @@ def __init__( :keyword port: TCP port of the database endpoint. Specified at create time. Defaults to an available port. :paramtype port: int - :keyword clustering_policy: Clustering policy - default is OSSCluster. This property must be - chosen at create time, and cannot be changed without deleting the database. Known values are: - "EnterpriseCluster" and "OSSCluster". + :keyword clustering_policy: Clustering policy - default is OSSCluster. Specified at create + time. Known values are: "EnterpriseCluster" and "OSSCluster". :paramtype clustering_policy: str or ~azure.mgmt.redisenterprise.models.ClusteringPolicy :keyword eviction_policy: Redis eviction policy - default is VolatileLRU. Known values are: "AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", "VolatileTTL", @@ -852,15 +613,6 @@ def __init__( :keyword geo_replication: Optional set of properties to configure geo replication for this database. :paramtype geo_replication: ~azure.mgmt.redisenterprise.models.DatabasePropertiesGeoReplication - :keyword defer_upgrade: Option to defer upgrade when newest version is released - default is - NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and - "NotDeferred". - :paramtype defer_upgrade: str or ~azure.mgmt.redisenterprise.models.DeferUpgradeSetting - :keyword access_keys_authentication: This property can be Enabled/Disabled to allow or deny - access with the current access keys. Can be updated even after database is created. Known - values are: "Disabled" and "Enabled". - :paramtype access_keys_authentication: str or - ~azure.mgmt.redisenterprise.models.AccessKeysAuthentication """ super().__init__(**kwargs) self.client_protocol = client_protocol @@ -872,9 +624,6 @@ def __init__( self.persistence = persistence self.modules = modules self.geo_replication = geo_replication - self.redis_version = None - self.defer_upgrade = defer_upgrade - self.access_keys_authentication = access_keys_authentication class DatabaseList(_serialization.Model): @@ -939,8 +688,8 @@ def __init__( self.linked_databases = linked_databases -class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance-attributes - """A partial update to the Redis Enterprise database. +class DatabaseUpdate(_serialization.Model): + """A partial update to the RedisEnterprise database. Variables are only populated by the server, and will be ignored when sending a request. @@ -958,9 +707,8 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance "Creating", "CreateFailed", "Updating", "UpdateFailed", "Deleting", "DeleteFailed", "Enabling", "EnableFailed", "Disabling", "DisableFailed", "Disabled", "Scaling", and "ScalingFailed". :vartype resource_state: str or ~azure.mgmt.redisenterprise.models.ResourceState - :ivar clustering_policy: Clustering policy - default is OSSCluster. This property must be - chosen at create time, and cannot be changed without deleting the database. Known values are: - "EnterpriseCluster" and "OSSCluster". + :ivar clustering_policy: Clustering policy - default is OSSCluster. Specified at create time. + Known values are: "EnterpriseCluster" and "OSSCluster". :vartype clustering_policy: str or ~azure.mgmt.redisenterprise.models.ClusteringPolicy :ivar eviction_policy: Redis eviction policy - default is VolatileLRU. Known values are: "AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", "VolatileTTL", @@ -974,23 +722,11 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance :ivar geo_replication: Optional set of properties to configure geo replication for this database. :vartype geo_replication: ~azure.mgmt.redisenterprise.models.DatabasePropertiesGeoReplication - :ivar redis_version: Version of Redis the database is running on, e.g. '6.0'. - :vartype redis_version: str - :ivar defer_upgrade: Option to defer upgrade when newest version is released - default is - NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and - "NotDeferred". - :vartype defer_upgrade: str or ~azure.mgmt.redisenterprise.models.DeferUpgradeSetting - :ivar access_keys_authentication: This property can be Enabled/Disabled to allow or deny access - with the current access keys. Can be updated even after database is created. Known values are: - "Disabled" and "Enabled". - :vartype access_keys_authentication: str or - ~azure.mgmt.redisenterprise.models.AccessKeysAuthentication """ _validation = { "provisioning_state": {"readonly": True}, "resource_state": {"readonly": True}, - "redis_version": {"readonly": True}, } _attribute_map = { @@ -1003,9 +739,6 @@ class DatabaseUpdate(_serialization.Model): # pylint: disable=too-many-instance "persistence": {"key": "properties.persistence", "type": "Persistence"}, "modules": {"key": "properties.modules", "type": "[Module]"}, "geo_replication": {"key": "properties.geoReplication", "type": "DatabasePropertiesGeoReplication"}, - "redis_version": {"key": "properties.redisVersion", "type": "str"}, - "defer_upgrade": {"key": "properties.deferUpgrade", "type": "str"}, - "access_keys_authentication": {"key": "properties.accessKeysAuthentication", "type": "str"}, } def __init__( @@ -1018,8 +751,6 @@ def __init__( persistence: Optional["_models.Persistence"] = None, modules: Optional[List["_models.Module"]] = None, geo_replication: Optional["_models.DatabasePropertiesGeoReplication"] = None, - defer_upgrade: Optional[Union[str, "_models.DeferUpgradeSetting"]] = None, - access_keys_authentication: Optional[Union[str, "_models.AccessKeysAuthentication"]] = None, **kwargs: Any ) -> None: """ @@ -1030,9 +761,8 @@ def __init__( :keyword port: TCP port of the database endpoint. Specified at create time. Defaults to an available port. :paramtype port: int - :keyword clustering_policy: Clustering policy - default is OSSCluster. This property must be - chosen at create time, and cannot be changed without deleting the database. Known values are: - "EnterpriseCluster" and "OSSCluster". + :keyword clustering_policy: Clustering policy - default is OSSCluster. Specified at create + time. Known values are: "EnterpriseCluster" and "OSSCluster". :paramtype clustering_policy: str or ~azure.mgmt.redisenterprise.models.ClusteringPolicy :keyword eviction_policy: Redis eviction policy - default is VolatileLRU. Known values are: "AllKeysLFU", "AllKeysLRU", "AllKeysRandom", "VolatileLRU", "VolatileLFU", "VolatileTTL", @@ -1046,15 +776,6 @@ def __init__( :keyword geo_replication: Optional set of properties to configure geo replication for this database. :paramtype geo_replication: ~azure.mgmt.redisenterprise.models.DatabasePropertiesGeoReplication - :keyword defer_upgrade: Option to defer upgrade when newest version is released - default is - NotDeferred. Learn more: https://aka.ms/redisversionupgrade. Known values are: "Deferred" and - "NotDeferred". - :paramtype defer_upgrade: str or ~azure.mgmt.redisenterprise.models.DeferUpgradeSetting - :keyword access_keys_authentication: This property can be Enabled/Disabled to allow or deny - access with the current access keys. Can be updated even after database is created. Known - values are: "Disabled" and "Enabled". - :paramtype access_keys_authentication: str or - ~azure.mgmt.redisenterprise.models.AccessKeysAuthentication """ super().__init__(**kwargs) self.client_protocol = client_protocol @@ -1066,9 +787,6 @@ def __init__( self.persistence = persistence self.modules = modules self.geo_replication = geo_replication - self.redis_version = None - self.defer_upgrade = defer_upgrade - self.access_keys_authentication = access_keys_authentication class ErrorAdditionalInfo(_serialization.Model): @@ -1142,6 +860,49 @@ def __init__(self, **kwargs: Any) -> None: self.additional_info = None +class ErrorDetailAutoGenerated(_serialization.Model): + """The error detail. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.redisenterprise.models.ErrorDetailAutoGenerated] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.redisenterprise.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorDetailAutoGenerated]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = None + self.additional_info = None + + class ErrorResponse(_serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). @@ -1163,6 +924,27 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A self.error = error +class ErrorResponseAutoGenerated(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + :ivar error: The error object. + :vartype error: ~azure.mgmt.redisenterprise.models.ErrorDetailAutoGenerated + """ + + _attribute_map = { + "error": {"key": "error", "type": "ErrorDetailAutoGenerated"}, + } + + def __init__(self, *, error: Optional["_models.ErrorDetailAutoGenerated"] = None, **kwargs: Any) -> None: + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.redisenterprise.models.ErrorDetailAutoGenerated + """ + super().__init__(**kwargs) + self.error = error + + class ExportClusterParameters(_serialization.Model): """Parameters for a Redis Enterprise export operation. @@ -1217,33 +999,59 @@ class ForceLinkParameters(_serialization.Model): All required parameters must be populated in order to send to server. + :ivar geo_replication: Properties to configure geo replication for this database. Required. + :vartype geo_replication: ~azure.mgmt.redisenterprise.models.ForceLinkParametersGeoReplication + """ + + _validation = { + "geo_replication": {"required": True}, + } + + _attribute_map = { + "geo_replication": {"key": "geoReplication", "type": "ForceLinkParametersGeoReplication"}, + } + + def __init__(self, *, geo_replication: "_models.ForceLinkParametersGeoReplication", **kwargs: Any) -> None: + """ + :keyword geo_replication: Properties to configure geo replication for this database. Required. + :paramtype geo_replication: + ~azure.mgmt.redisenterprise.models.ForceLinkParametersGeoReplication + """ + super().__init__(**kwargs) + self.geo_replication = geo_replication + + +class ForceLinkParametersGeoReplication(_serialization.Model): + """Properties to configure geo replication for this database. + :ivar group_nickname: The name of the group of linked database resources. This should match the - existing replication group name. Required. + existing replication group name. :vartype group_nickname: str :ivar linked_databases: The resource IDs of the databases that are expected to be linked and included in the replication group. This parameter is used to validate that the linking is to - the expected (unlinked) part of the replication group, if it is splintered. Required. + the expected (unlinked) part of the replication group, if it is splintered. :vartype linked_databases: list[~azure.mgmt.redisenterprise.models.LinkedDatabase] """ - _validation = { - "group_nickname": {"required": True}, - "linked_databases": {"required": True}, - } - _attribute_map = { "group_nickname": {"key": "groupNickname", "type": "str"}, "linked_databases": {"key": "linkedDatabases", "type": "[LinkedDatabase]"}, } - def __init__(self, *, group_nickname: str, linked_databases: List["_models.LinkedDatabase"], **kwargs: Any) -> None: + def __init__( + self, + *, + group_nickname: Optional[str] = None, + linked_databases: Optional[List["_models.LinkedDatabase"]] = None, + **kwargs: Any + ) -> None: """ :keyword group_nickname: The name of the group of linked database resources. This should match - the existing replication group name. Required. + the existing replication group name. :paramtype group_nickname: str :keyword linked_databases: The resource IDs of the databases that are expected to be linked and included in the replication group. This parameter is used to validate that the linking is to - the expected (unlinked) part of the replication group, if it is splintered. Required. + the expected (unlinked) part of the replication group, if it is splintered. :paramtype linked_databases: list[~azure.mgmt.redisenterprise.models.LinkedDatabase] """ super().__init__(**kwargs) @@ -1252,7 +1060,7 @@ def __init__(self, *, group_nickname: str, linked_databases: List["_models.Linke class ForceUnlinkParameters(_serialization.Model): - """Parameters for a redis enterprise active geo-replication force unlink operation. + """Parameters for a Redis Enterprise Active Geo Replication Force Unlink operation. All required parameters must be populated in order to send to server. @@ -1621,17 +1429,14 @@ def __init__( class Persistence(_serialization.Model): - """Persistence-related configuration for the Redis Enterprise database. + """Persistence-related configuration for the RedisEnterprise database. - :ivar aof_enabled: Sets whether AOF is enabled. Note that at most one of AOF or RDB persistence - may be enabled. + :ivar aof_enabled: Sets whether AOF is enabled. :vartype aof_enabled: bool - :ivar rdb_enabled: Sets whether RDB is enabled. Note that at most one of AOF or RDB persistence - may be enabled. + :ivar rdb_enabled: Sets whether RDB is enabled. :vartype rdb_enabled: bool - :ivar aof_frequency: Sets the frequency at which data is written to disk. Defaults to '1s', - meaning 'every second'. Note that the 'always' setting is deprecated, because of its - performance impact. Known values are: "1s" and "always". + :ivar aof_frequency: Sets the frequency at which data is written to disk. Known values are: + "1s" and "always". :vartype aof_frequency: str or ~azure.mgmt.redisenterprise.models.AofFrequency :ivar rdb_frequency: Sets the frequency at which a snapshot of the database is created. Known values are: "1h", "6h", and "12h". @@ -1655,15 +1460,12 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword aof_enabled: Sets whether AOF is enabled. Note that at most one of AOF or RDB - persistence may be enabled. + :keyword aof_enabled: Sets whether AOF is enabled. :paramtype aof_enabled: bool - :keyword rdb_enabled: Sets whether RDB is enabled. Note that at most one of AOF or RDB - persistence may be enabled. + :keyword rdb_enabled: Sets whether RDB is enabled. :paramtype rdb_enabled: bool - :keyword aof_frequency: Sets the frequency at which data is written to disk. Defaults to '1s', - meaning 'every second'. Note that the 'always' setting is deprecated, because of its - performance impact. Known values are: "1s" and "always". + :keyword aof_frequency: Sets the frequency at which data is written to disk. Known values are: + "1s" and "always". :paramtype aof_frequency: str or ~azure.mgmt.redisenterprise.models.AofFrequency :keyword rdb_frequency: Sets the frequency at which a snapshot of the database is created. Known values are: "1h", "6h", and "12h". @@ -1928,32 +1730,17 @@ def __init__(self, *, key_type: Union[str, "_models.AccessKeyType"], **kwargs: A class Sku(_serialization.Model): - """SKU parameters supplied to the create Redis Enterprise cluster operation. + """SKU parameters supplied to the create RedisEnterprise operation. All required parameters must be populated in order to send to server. - :ivar name: The level of Redis Enterprise cluster to deploy. Possible values: ('Balanced_B5', - 'MemoryOptimized_M10', 'ComputeOptimized_X5', etc.). For more information on SKUs see the - latest pricing documentation. Note that additional SKUs may become supported in the future. - Required. Known values are: "Enterprise_E1", "Enterprise_E5", "Enterprise_E10", - "Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "Enterprise_E200", "Enterprise_E400", - "EnterpriseFlash_F300", "EnterpriseFlash_F700", "EnterpriseFlash_F1500", "Balanced_B0", - "Balanced_B1", "Balanced_B3", "Balanced_B5", "Balanced_B10", "Balanced_B20", "Balanced_B50", - "Balanced_B100", "Balanced_B150", "Balanced_B250", "Balanced_B350", "Balanced_B500", - "Balanced_B700", "Balanced_B1000", "MemoryOptimized_M10", "MemoryOptimized_M20", - "MemoryOptimized_M50", "MemoryOptimized_M100", "MemoryOptimized_M150", "MemoryOptimized_M250", - "MemoryOptimized_M350", "MemoryOptimized_M500", "MemoryOptimized_M700", - "MemoryOptimized_M1000", "MemoryOptimized_M1500", "MemoryOptimized_M2000", - "ComputeOptimized_X3", "ComputeOptimized_X5", "ComputeOptimized_X10", "ComputeOptimized_X20", - "ComputeOptimized_X50", "ComputeOptimized_X100", "ComputeOptimized_X150", - "ComputeOptimized_X250", "ComputeOptimized_X350", "ComputeOptimized_X500", - "ComputeOptimized_X700", "FlashOptimized_A250", "FlashOptimized_A500", "FlashOptimized_A700", - "FlashOptimized_A1000", "FlashOptimized_A1500", "FlashOptimized_A2000", and - "FlashOptimized_A4500". + :ivar name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, + EnterpriseFlash_F300 etc.). Required. Known values are: "Enterprise_E1", "Enterprise_E5", + "Enterprise_E10", "Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "Enterprise_E200", + "Enterprise_E400", "EnterpriseFlash_F300", "EnterpriseFlash_F700", and "EnterpriseFlash_F1500". :vartype name: str or ~azure.mgmt.redisenterprise.models.SkuName - :ivar capacity: This property is only used with Enterprise and EnterpriseFlash SKUs. Determines - the size of the cluster. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, - ...) for EnterpriseFlash SKUs. + :ivar capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on SKU. + Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. :vartype capacity: int """ @@ -1968,28 +1755,13 @@ class Sku(_serialization.Model): def __init__(self, *, name: Union[str, "_models.SkuName"], capacity: Optional[int] = None, **kwargs: Any) -> None: """ - :keyword name: The level of Redis Enterprise cluster to deploy. Possible values: - ('Balanced_B5', 'MemoryOptimized_M10', 'ComputeOptimized_X5', etc.). For more information on - SKUs see the latest pricing documentation. Note that additional SKUs may become supported in - the future. Required. Known values are: "Enterprise_E1", "Enterprise_E5", "Enterprise_E10", - "Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "Enterprise_E200", "Enterprise_E400", - "EnterpriseFlash_F300", "EnterpriseFlash_F700", "EnterpriseFlash_F1500", "Balanced_B0", - "Balanced_B1", "Balanced_B3", "Balanced_B5", "Balanced_B10", "Balanced_B20", "Balanced_B50", - "Balanced_B100", "Balanced_B150", "Balanced_B250", "Balanced_B350", "Balanced_B500", - "Balanced_B700", "Balanced_B1000", "MemoryOptimized_M10", "MemoryOptimized_M20", - "MemoryOptimized_M50", "MemoryOptimized_M100", "MemoryOptimized_M150", "MemoryOptimized_M250", - "MemoryOptimized_M350", "MemoryOptimized_M500", "MemoryOptimized_M700", - "MemoryOptimized_M1000", "MemoryOptimized_M1500", "MemoryOptimized_M2000", - "ComputeOptimized_X3", "ComputeOptimized_X5", "ComputeOptimized_X10", "ComputeOptimized_X20", - "ComputeOptimized_X50", "ComputeOptimized_X100", "ComputeOptimized_X150", - "ComputeOptimized_X250", "ComputeOptimized_X350", "ComputeOptimized_X500", - "ComputeOptimized_X700", "FlashOptimized_A250", "FlashOptimized_A500", "FlashOptimized_A700", - "FlashOptimized_A1000", "FlashOptimized_A1500", "FlashOptimized_A2000", and - "FlashOptimized_A4500". + :keyword name: The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, + EnterpriseFlash_F300 etc.). Required. Known values are: "Enterprise_E1", "Enterprise_E5", + "Enterprise_E10", "Enterprise_E20", "Enterprise_E50", "Enterprise_E100", "Enterprise_E200", + "Enterprise_E400", "EnterpriseFlash_F300", "EnterpriseFlash_F700", and "EnterpriseFlash_F1500". :paramtype name: str or ~azure.mgmt.redisenterprise.models.SkuName - :keyword capacity: This property is only used with Enterprise and EnterpriseFlash SKUs. - Determines the size of the cluster. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, - 9, 15, ...) for EnterpriseFlash SKUs. + :keyword capacity: The size of the RedisEnterprise cluster. Defaults to 2 or 3 depending on + SKU. Valid values are (2, 4, 6, ...) for Enterprise SKUs and (3, 9, 15, ...) for Flash SKUs. :paramtype capacity: int """ super().__init__(**kwargs) @@ -1997,70 +1769,6 @@ def __init__(self, *, name: Union[str, "_models.SkuName"], capacity: Optional[in self.capacity = capacity -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.redisenterprise.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - class UserAssignedIdentity(_serialization.Model): """User assigned identity properties. diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_redis_enterprise_management_client_enums.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_redis_enterprise_management_client_enums.py index c78d2d2c5b56..0058db9601fc 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_redis_enterprise_management_client_enums.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/models/_redis_enterprise_management_client_enums.py @@ -10,15 +10,6 @@ from azure.core import CaseInsensitiveEnumMeta -class AccessKeysAuthentication(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """This property can be Enabled/Disabled to allow or deny access with the current access keys. Can - be updated even after database is created. - """ - - DISABLED = "Disabled" - ENABLED = "Enabled" - - class AccessKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Which access key to regenerate.""" @@ -33,25 +24,17 @@ class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class AofFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Sets the frequency at which data is written to disk. Defaults to '1s', meaning 'every second'. - Note that the 'always' setting is deprecated, because of its performance impact. - """ + """Sets the frequency at which data is written to disk.""" ONE_S = "1s" ALWAYS = "always" class ClusteringPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Clustering policy - default is OSSCluster. This property must be chosen at create time, and - cannot be changed without deleting the database. - """ + """Clustering policy - default is OSSCluster. Specified at create time.""" ENTERPRISE_CLUSTER = "EnterpriseCluster" - """Enterprise clustering policy uses only the classic redis protocol, which does not support redis - cluster commands.""" OSS_CLUSTER = "OSSCluster" - """OSS clustering policy follows the redis cluster specification, and requires all clients to - support redis clustering.""" class CmkIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -63,24 +46,6 @@ class CmkIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_ASSIGNED_IDENTITY = "userAssignedIdentity" -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class DeferUpgradeSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Option to defer upgrade when newest version is released - default is NotDeferred. Learn more: - https://aka.ms/redisversionupgrade. - """ - - DEFERRED = "Deferred" - NOT_DEFERRED = "NotDeferred" - - class EvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Redis eviction policy - default is VolatileLRU.""" @@ -94,15 +59,6 @@ class EvictionPolicy(str, Enum, metaclass=CaseInsensitiveEnumMeta): NO_EVICTION = "NoEviction" -class HighAvailability(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enabled by default. If highAvailability is disabled, the data set is not replicated. This - affects the availability SLA, and increases the risk of data loss. - """ - - ENABLED = "Enabled" - DISABLED = "Disabled" - - class LinkState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """State of the link between the database resources.""" @@ -179,17 +135,6 @@ class RdbFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta): TWELVE_H = "12h" -class RedundancyMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Explains the current redundancy strategy of the cluster, which affects the expected SLA.""" - - NONE = "None" - """No redundancy. Availability loss will occur.""" - LR = "LR" - """Local redundancy with high availability.""" - ZR = "ZR" - """Zone redundant. Higher availability.""" - - class ResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Current resource status.""" @@ -210,9 +155,8 @@ class ResourceState(str, Enum, metaclass=CaseInsensitiveEnumMeta): class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The level of Redis Enterprise cluster to deploy. Possible values: ('Balanced_B5', - 'MemoryOptimized_M10', 'ComputeOptimized_X5', etc.). For more information on SKUs see the - latest pricing documentation. Note that additional SKUs may become supported in the future. + """The type of RedisEnterprise cluster to deploy. Possible values: (Enterprise_E10, + EnterpriseFlash_F300 etc.). """ ENTERPRISE_E1 = "Enterprise_E1" @@ -226,57 +170,10 @@ class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENTERPRISE_FLASH_F300 = "EnterpriseFlash_F300" ENTERPRISE_FLASH_F700 = "EnterpriseFlash_F700" ENTERPRISE_FLASH_F1500 = "EnterpriseFlash_F1500" - BALANCED_B0 = "Balanced_B0" - BALANCED_B1 = "Balanced_B1" - BALANCED_B3 = "Balanced_B3" - BALANCED_B5 = "Balanced_B5" - BALANCED_B10 = "Balanced_B10" - BALANCED_B20 = "Balanced_B20" - BALANCED_B50 = "Balanced_B50" - BALANCED_B100 = "Balanced_B100" - BALANCED_B150 = "Balanced_B150" - BALANCED_B250 = "Balanced_B250" - BALANCED_B350 = "Balanced_B350" - BALANCED_B500 = "Balanced_B500" - BALANCED_B700 = "Balanced_B700" - BALANCED_B1000 = "Balanced_B1000" - MEMORY_OPTIMIZED_M10 = "MemoryOptimized_M10" - MEMORY_OPTIMIZED_M20 = "MemoryOptimized_M20" - MEMORY_OPTIMIZED_M50 = "MemoryOptimized_M50" - MEMORY_OPTIMIZED_M100 = "MemoryOptimized_M100" - MEMORY_OPTIMIZED_M150 = "MemoryOptimized_M150" - MEMORY_OPTIMIZED_M250 = "MemoryOptimized_M250" - MEMORY_OPTIMIZED_M350 = "MemoryOptimized_M350" - MEMORY_OPTIMIZED_M500 = "MemoryOptimized_M500" - MEMORY_OPTIMIZED_M700 = "MemoryOptimized_M700" - MEMORY_OPTIMIZED_M1000 = "MemoryOptimized_M1000" - MEMORY_OPTIMIZED_M1500 = "MemoryOptimized_M1500" - MEMORY_OPTIMIZED_M2000 = "MemoryOptimized_M2000" - COMPUTE_OPTIMIZED_X3 = "ComputeOptimized_X3" - COMPUTE_OPTIMIZED_X5 = "ComputeOptimized_X5" - COMPUTE_OPTIMIZED_X10 = "ComputeOptimized_X10" - COMPUTE_OPTIMIZED_X20 = "ComputeOptimized_X20" - COMPUTE_OPTIMIZED_X50 = "ComputeOptimized_X50" - COMPUTE_OPTIMIZED_X100 = "ComputeOptimized_X100" - COMPUTE_OPTIMIZED_X150 = "ComputeOptimized_X150" - COMPUTE_OPTIMIZED_X250 = "ComputeOptimized_X250" - COMPUTE_OPTIMIZED_X350 = "ComputeOptimized_X350" - COMPUTE_OPTIMIZED_X500 = "ComputeOptimized_X500" - COMPUTE_OPTIMIZED_X700 = "ComputeOptimized_X700" - FLASH_OPTIMIZED_A250 = "FlashOptimized_A250" - FLASH_OPTIMIZED_A500 = "FlashOptimized_A500" - FLASH_OPTIMIZED_A700 = "FlashOptimized_A700" - FLASH_OPTIMIZED_A1000 = "FlashOptimized_A1000" - FLASH_OPTIMIZED_A1500 = "FlashOptimized_A1500" - FLASH_OPTIMIZED_A2000 = "FlashOptimized_A2000" - FLASH_OPTIMIZED_A4500 = "FlashOptimized_A4500" class TlsVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The minimum TLS version for the cluster to support, e.g. '1.2'. Newer versions can be added in - the future. Note that TLS 1.0 and TLS 1.1 are now completely obsolete -- you cannot use them. - They are mentioned only for the sake of consistency with old API versions. - """ + """The minimum TLS version for the cluster to support, e.g. '1.2'.""" ONE0 = "1.0" ONE1 = "1.1" diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/__init__.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/__init__.py index 663e4bdcb58e..bb6c16197a30 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/__init__.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/__init__.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._operations_status_operations import OperationsStatusOperations -from ._redis_enterprise_operations import RedisEnterpriseOperations -from ._databases_operations import DatabasesOperations -from ._access_policy_assignment_operations import AccessPolicyAssignmentOperations -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations -from ._private_link_resources_operations import PrivateLinkResourcesOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations_status_operations import OperationsStatusOperations # type: ignore +from ._redis_enterprise_operations import RedisEnterpriseOperations # type: ignore +from ._databases_operations import DatabasesOperations # type: ignore +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore +from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -23,9 +28,8 @@ "OperationsStatusOperations", "RedisEnterpriseOperations", "DatabasesOperations", - "AccessPolicyAssignmentOperations", "PrivateEndpointConnectionsOperations", "PrivateLinkResourcesOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_access_policy_assignment_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_access_policy_assignment_operations.py deleted file mode 100644 index daeaa77a1051..000000000000 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_access_policy_assignment_operations.py +++ /dev/null @@ -1,746 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_update_request( - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/accessPolicyAssignments/{accessPolicyAssignmentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "accessPolicyAssignmentName": _SERIALIZER.url( - "access_policy_assignment_name", access_policy_assignment_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/accessPolicyAssignments/{accessPolicyAssignmentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "accessPolicyAssignmentName": _SERIALIZER.url( - "access_policy_assignment_name", access_policy_assignment_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/accessPolicyAssignments/{accessPolicyAssignmentName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "accessPolicyAssignmentName": _SERIALIZER.url( - "access_policy_assignment_name", access_policy_assignment_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request( - resource_group_name: str, cluster_name: str, database_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/accessPolicyAssignments", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class AccessPolicyAssignmentOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.redisenterprise.RedisEnterpriseManagementClient`'s - :attr:`access_policy_assignment` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _create_update_initial( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - parameters: Union[_models.AccessPolicyAssignment, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "AccessPolicyAssignment") - - _request = build_create_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - parameters: _models.AccessPolicyAssignment, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessPolicyAssignment]: - """Creates/Updates a particular access policy assignment for a database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :param parameters: Parameters supplied to the create access policy assignment for database. - Required. - :type parameters: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AccessPolicyAssignment or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AccessPolicyAssignment]: - """Creates/Updates a particular access policy assignment for a database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :param parameters: Parameters supplied to the create access policy assignment for database. - Required. - :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 - :return: An instance of LROPoller that returns either AccessPolicyAssignment or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_update( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - parameters: Union[_models.AccessPolicyAssignment, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AccessPolicyAssignment]: - """Creates/Updates a particular access policy assignment for a database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :param parameters: Parameters supplied to the create access policy assignment for database. Is - either a AccessPolicyAssignment type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment or IO[bytes] - :return: An instance of LROPoller that returns either AccessPolicyAssignment or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AccessPolicyAssignment] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_update_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AccessPolicyAssignment", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AccessPolicyAssignment].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AccessPolicyAssignment]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - **kwargs: Any - ) -> _models.AccessPolicyAssignment: - """Gets information about access policy assignment for database. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :return: AccessPolicyAssignment or the result of cls(response) - :rtype: ~azure.mgmt.redisenterprise.models.AccessPolicyAssignment - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AccessPolicyAssignment] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AccessPolicyAssignment", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - cluster_name: str, - database_name: str, - access_policy_assignment_name: str, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes a single access policy assignment. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :param access_policy_assignment_name: The name of the Redis Enterprise database access policy - assignment. Required. - :type access_policy_assignment_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - access_policy_assignment_name=access_policy_assignment_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any - ) -> Iterable["_models.AccessPolicyAssignment"]: - """Gets all access policy assignments.. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :return: An iterator like instance of either AccessPolicyAssignment or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redisenterprise.models.AccessPolicyAssignment] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.AccessPolicyAssignmentList] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AccessPolicyAssignmentList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_databases_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_databases_operations.py index f46b7772b6f4..c6d63724b07b 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_databases_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_databases_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +36,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +50,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +63,9 @@ def build_list_by_cluster_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), } _url: str = _url.format(**path_format_arguments) # type: ignore @@ -83,7 +85,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -96,8 +98,12 @@ def build_create_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -120,7 +126,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -133,8 +139,12 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -157,7 +167,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,8 +179,12 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -191,7 +205,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -203,8 +217,12 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -225,7 +243,7 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,8 +255,12 @@ def build_list_keys_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -259,7 +281,7 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -272,8 +294,12 @@ def build_regenerate_key_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -296,7 +322,7 @@ def build_import_method_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -309,8 +335,12 @@ def build_import_method_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -333,7 +363,7 @@ def build_export_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -346,8 +376,12 @@ def build_export_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -370,7 +404,7 @@ def build_force_unlink_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -383,8 +417,12 @@ def build_force_unlink_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -407,7 +445,7 @@ def build_force_link_to_replication_group_request( # pylint: disable=name-too-l _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -420,8 +458,12 @@ def build_force_link_to_replication_group_request( # pylint: disable=name-too-l "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -444,7 +486,7 @@ def build_flush_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -457,8 +499,12 @@ def build_flush_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), + "databaseName": _SERIALIZER.url( + "database_name", database_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -475,40 +521,6 @@ def build_flush_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_upgrade_db_redis_version_request( - resource_group_name: str, cluster_name: str, database_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redisEnterprise/{clusterName}/databases/{databaseName}/upgradeDBRedisVersion", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "databaseName": _SERIALIZER.url("database_name", database_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - class DatabasesOperations: # pylint: disable=too-many-public-methods """ .. warning:: @@ -532,12 +544,14 @@ def __init__(self, *args, **kwargs): def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> Iterable["_models.Database"]: - """Gets all databases in the specified Redis Enterprise cluster. + """Gets all databases in the specified RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: An iterator like instance of either Database or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redisenterprise.models.Database] @@ -549,7 +563,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.DatabaseList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -620,7 +634,7 @@ def _create_initial( parameters: Union[_models.Database, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -697,7 +711,9 @@ def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -727,7 +743,9 @@ def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -755,7 +773,9 @@ def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -824,7 +844,7 @@ def _update_initial( parameters: Union[_models.DatabaseUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -908,7 +928,9 @@ def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -938,7 +960,9 @@ def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -966,7 +990,9 @@ def begin_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1029,12 +1055,14 @@ def get_long_running_output(pipeline_response): @distributed_trace def get(self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any) -> _models.Database: - """Gets information about a database in a Redis Enterprise cluster. + """Gets information about a database in a RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1042,7 +1070,7 @@ def get(self, resource_group_name: str, cluster_name: str, database_name: str, * :rtype: ~azure.mgmt.redisenterprise.models.Database :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1089,7 +1117,7 @@ def get(self, resource_group_name: str, cluster_name: str, database_name: str, * def _delete_initial( self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1154,7 +1182,9 @@ def begin_delete( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1209,12 +1239,14 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list_keys( self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any ) -> _models.AccessKeys: - """Retrieves the access keys for the Redis Enterprise database. + """Retrieves the access keys for the RedisEnterprise database. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1222,7 +1254,7 @@ def list_keys( :rtype: ~azure.mgmt.redisenterprise.models.AccessKeys :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1274,7 +1306,7 @@ def _regenerate_key_initial( parameters: Union[_models.RegenerateKeyParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1353,12 +1385,14 @@ def begin_regenerate_key( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AccessKeys]: - """Regenerates the Redis Enterprise database's access keys. + """Regenerates the RedisEnterprise database's access keys. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1383,12 +1417,14 @@ def begin_regenerate_key( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.AccessKeys]: - """Regenerates the Redis Enterprise database's access keys. + """Regenerates the RedisEnterprise database's access keys. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1411,12 +1447,14 @@ def begin_regenerate_key( parameters: Union[_models.RegenerateKeyParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.AccessKeys]: - """Regenerates the Redis Enterprise database's access keys. + """Regenerates the RedisEnterprise database's access keys. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1485,7 +1523,7 @@ def _import_method_initial( parameters: Union[_models.ImportClusterParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1569,7 +1607,9 @@ def begin_import_method( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1599,7 +1639,9 @@ def begin_import_method( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1627,7 +1669,9 @@ def begin_import_method( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1692,7 +1736,7 @@ def _export_initial( parameters: Union[_models.ExportClusterParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1776,7 +1820,9 @@ def begin_export( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1806,7 +1852,9 @@ def begin_export( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1834,7 +1882,9 @@ def begin_export( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -1899,7 +1949,7 @@ def _force_unlink_initial( parameters: Union[_models.ForceUnlinkParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1983,7 +2033,9 @@ def begin_force_unlink( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2013,7 +2065,9 @@ def begin_force_unlink( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2041,7 +2095,9 @@ def begin_force_unlink( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2106,7 +2162,7 @@ def _force_link_to_replication_group_initial( parameters: Union[_models.ForceLinkParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2157,7 +2213,7 @@ def _force_link_to_replication_group_initial( except (StreamConsumedError, StreamClosedError): pass map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponseAutoGenerated, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) response_headers = {} @@ -2191,7 +2247,9 @@ def begin_force_link_to_replication_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2223,7 +2281,9 @@ def begin_force_link_to_replication_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2253,7 +2313,9 @@ def begin_force_link_to_replication_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2318,7 +2380,7 @@ def _flush_initial( parameters: Union[_models.FlushParameters, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -2402,7 +2464,9 @@ def begin_flush( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2432,7 +2496,9 @@ def begin_flush( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2460,7 +2526,9 @@ def begin_flush( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param database_name: The name of the Redis Enterprise database. Required. :type database_name: str @@ -2516,121 +2584,3 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- deserialization_callback=get_long_running_output, ) return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _upgrade_db_redis_version_initial( - self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_upgrade_db_redis_version_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_upgrade_db_redis_version( - self, resource_group_name: str, cluster_name: str, database_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Upgrades the database Redis version to the latest available. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. - :type cluster_name: str - :param database_name: The name of the Redis Enterprise database. Required. - :type database_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._upgrade_db_redis_version_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - database_name=database_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations.py index b4c6a14e1065..e35360a21526 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +42,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -91,7 +90,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations_status_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations_status_operations.py index bcca8f2a0b05..429a50084b18 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations_status_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_operations_status_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,7 +28,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +40,7 @@ def build_get_request(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +96,7 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat :rtype: ~azure.mgmt.redisenterprise.models.OperationStatus :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_endpoint_connections_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_endpoint_connections_operations.py index 87670e0c8380..0ba9a0c8cf48 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_endpoint_connections_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +47,7 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -60,7 +59,9 @@ def build_list_request(resource_group_name: str, cluster_name: str, subscription "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -85,7 +86,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +98,9 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" ), @@ -125,7 +128,7 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -138,7 +141,9 @@ def build_put_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" @@ -168,7 +173,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +185,9 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "privateEndpointConnectionName": _SERIALIZER.url( "private_endpoint_connection_name", private_endpoint_connection_name, "str" @@ -221,12 +228,14 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> Iterable["_models.PrivateEndpointConnection"]: - """Lists all the private endpoint connections associated with the Redis Enterprise cluster. + """Lists all the private endpoint connections associated with the RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) @@ -240,7 +249,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -307,12 +316,14 @@ def get_next(next_link=None): def get( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> _models.PrivateEndpointConnection: - """Gets the specified private endpoint connection associated with the Redis Enterprise cluster. + """Gets the specified private endpoint connection associated with the RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. @@ -321,7 +332,7 @@ def get( :rtype: ~azure.mgmt.redisenterprise.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -373,7 +384,7 @@ def _put_initial( properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,13 +456,15 @@ def begin_put( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: - """Updates the state of the specified private endpoint connection associated with the Redis - Enterprise cluster. + """Updates the state of the specified private endpoint connection associated with the + RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. @@ -479,13 +492,15 @@ def begin_put( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: - """Updates the state of the specified private endpoint connection associated with the Redis - Enterprise cluster. + """Updates the state of the specified private endpoint connection associated with the + RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. @@ -511,13 +526,15 @@ def begin_put( properties: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: - """Updates the state of the specified private endpoint connection associated with the Redis - Enterprise cluster. + """Updates the state of the specified private endpoint connection associated with the + RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. @@ -582,7 +599,7 @@ def get_long_running_output(pipeline_response): def _delete_initial( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -642,12 +659,14 @@ def _delete_initial( def begin_delete( self, resource_group_name: str, cluster_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> LROPoller[None]: - """Deletes the specified private endpoint connection associated with the Redis Enterprise cluster. + """Deletes the specified private endpoint connection associated with the RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :param private_endpoint_connection_name: The name of the private endpoint connection associated with the Azure resource. Required. diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_link_resources_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_link_resources_operations.py index 38ab59b4a523..b22447d542a1 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_link_resources_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_private_link_resources_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -31,7 +30,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +44,7 @@ def build_list_by_cluster_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +56,9 @@ def build_list_by_cluster_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -95,12 +96,14 @@ def __init__(self, *args, **kwargs): def list_by_cluster( self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> Iterable["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a Redis Enterprise cluster. + """Gets the private link resources that need to be created for a RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redisenterprise.models.PrivateLinkResource] @@ -112,7 +115,7 @@ def list_by_cluster( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_redis_enterprise_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_redis_enterprise_operations.py index 6586f15a9a72..c47d00ee3ce0 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_redis_enterprise_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/azure/mgmt/redisenterprise/operations/_redis_enterprise_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +7,7 @@ # -------------------------------------------------------------------------- from io import IOBase import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -36,7 +35,7 @@ if sys.version_info >= (3, 9): from collections.abc import MutableMapping else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports + from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +49,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -63,7 +62,9 @@ def build_create_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -86,7 +87,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +100,9 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -122,7 +125,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -134,7 +137,9 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -153,7 +158,7 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -165,7 +170,9 @@ def build_get_request(resource_group_name: str, cluster_name: str, subscription_ "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[A-Za-z0-9]{1,60}$"), + "clusterName": _SERIALIZER.url( + "cluster_name", cluster_name, "str", pattern=r"^(?=.{1,60}$)[A-Za-z0-9]+(-[A-Za-z0-9]+)*$" + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } @@ -184,7 +191,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,7 +221,7 @@ def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-04-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -256,7 +263,7 @@ def __init__(self, *args, **kwargs): def _create_initial( self, resource_group_name: str, cluster_name: str, parameters: Union[_models.Cluster, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -331,9 +338,11 @@ def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Create Redis Enterprise operation. Required. + :param parameters: Parameters supplied to the Create RedisEnterprise operation. Required. :type parameters: ~azure.mgmt.redisenterprise.models.Cluster :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -358,9 +367,11 @@ def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Create Redis Enterprise operation. Required. + :param parameters: Parameters supplied to the Create RedisEnterprise operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -379,9 +390,11 @@ def begin_create( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Create Redis Enterprise operation. Is either a + :param parameters: Parameters supplied to the Create RedisEnterprise operation. Is either a Cluster type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.redisenterprise.models.Cluster or IO[bytes] :return: An instance of LROPoller that returns either Cluster or the result of cls(response) @@ -444,7 +457,7 @@ def _update_initial( parameters: Union[_models.ClusterUpdate, IO[bytes]], **kwargs: Any ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -521,14 +534,16 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Updates an existing Redis Enterprise cluster. + """Updates an existing RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Update Redis Enterprise operation. Required. + :param parameters: Parameters supplied to the Update RedisEnterprise operation. Required. :type parameters: ~azure.mgmt.redisenterprise.models.ClusterUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". @@ -548,14 +563,16 @@ def begin_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Updates an existing Redis Enterprise cluster. + """Updates an existing RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Update Redis Enterprise operation. Required. + :param parameters: Parameters supplied to the Update RedisEnterprise operation. Required. :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". @@ -573,14 +590,16 @@ def begin_update( parameters: Union[_models.ClusterUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Cluster]: - """Updates an existing Redis Enterprise cluster. + """Updates an existing RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str - :param parameters: Parameters supplied to the Update Redis Enterprise operation. Is either a + :param parameters: Parameters supplied to the Update RedisEnterprise operation. Is either a ClusterUpdate type or a IO[bytes] type. Required. :type parameters: ~azure.mgmt.redisenterprise.models.ClusterUpdate or IO[bytes] :return: An instance of LROPoller that returns either Cluster or the result of cls(response) @@ -637,7 +656,7 @@ def get_long_running_output(pipeline_response): ) def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -694,12 +713,14 @@ def _delete_initial(self, resource_group_name: str, cluster_name: str, **kwargs: @distributed_trace def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a Redis Enterprise cache cluster. + """Deletes a RedisEnterprise cache cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] @@ -749,18 +770,20 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- @distributed_trace def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.Cluster: - """Gets information about a Redis Enterprise cluster. + """Gets information about a RedisEnterprise cluster. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param cluster_name: The name of the Redis Enterprise cluster. Required. + :param cluster_name: The name of the Redis Enterprise cluster. Name must be 1-60 characters + long. Allowed characters(A-Z, a-z, 0-9) and hyphen(-). There can be no leading nor trailing nor + consecutive hyphens. Required. :type cluster_name: str :return: Cluster or the result of cls(response) :rtype: ~azure.mgmt.redisenterprise.models.Cluster :raises ~azure.core.exceptions.HttpResponseError: """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -805,7 +828,7 @@ def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _mo @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Cluster"]: - """Lists all Redis Enterprise clusters in a resource group. + """Lists all RedisEnterprise clusters in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -820,7 +843,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -884,7 +907,7 @@ def get_next(next_link=None): @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: - """Lists all Redis Enterprise clusters in the specified subscription. + """Gets all RedisEnterprise clusters in the specified subscription. :return: An iterator like instance of either Cluster or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.redisenterprise.models.Cluster] @@ -896,7 +919,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Cluster"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None) - error_map: MutableMapping[int, Type[HttpResponseError]] = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_list.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_list.py index 3336773c81a6..5fc4395096b0 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_list.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/OperationsList.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/OperationsList.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_status_get.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_status_get.py index 716bd4c4692f..bf099825ef76 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_status_get.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/operations_status_get.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.operations_status.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/OperationsStatusGet.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/OperationsStatusGet.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_create_update.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_create_update.py deleted file mode 100644 index 8e4fef2298b5..000000000000 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_create_update.py +++ /dev/null @@ -1,47 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redisenterprise -# USAGE - python redis_enterprise_access_policy_assignment_create_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RedisEnterpriseManagementClient( - credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", - ) - - response = client.access_policy_assignment.begin_create_update( - resource_group_name="rg1", - cluster_name="cache1", - database_name="default", - access_policy_assignment_name="defaultTestEntraApp1", - parameters={ - "properties": {"accessPolicyName": "default", "user": {"objectId": "6497c918-11ad-41e7-1b0f-7c518a87d0b0"}} - }, - ).result() - print(response) - - -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseAccessPolicyAssignmentCreateUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_delete.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_delete.py deleted file mode 100644 index 59361df0c0c2..000000000000 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redisenterprise -# USAGE - python redis_enterprise_access_policy_assignment_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RedisEnterpriseManagementClient( - credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", - ) - - client.access_policy_assignment.begin_delete( - resource_group_name="rg1", - cluster_name="cache1", - database_name="default", - access_policy_assignment_name="defaultTestEntraApp1", - ).result() - - -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseAccessPolicyAssignmentDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_get.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_get.py deleted file mode 100644 index bc9c3406868b..000000000000 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignment_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redisenterprise -# USAGE - python redis_enterprise_access_policy_assignment_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RedisEnterpriseManagementClient( - credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", - ) - - response = client.access_policy_assignment.get( - resource_group_name="rg1", - cluster_name="cache1", - database_name="default", - access_policy_assignment_name="accessPolicyAssignmentName1", - ) - print(response) - - -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseAccessPolicyAssignmentGet.json -if __name__ == "__main__": - main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignments_list.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignments_list.py deleted file mode 100644 index 560e50f95f82..000000000000 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_access_policy_assignments_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redisenterprise -# USAGE - python redis_enterprise_access_policy_assignments_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RedisEnterpriseManagementClient( - credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", - ) - - response = client.access_policy_assignment.list( - resource_group_name="rg1", - cluster_name="cache1", - database_name="default", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseAccessPolicyAssignmentsList.json -if __name__ == "__main__": - main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_create.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_create.py index dfe726740a32..7faad43497ce 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_create.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_create.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.redis_enterprise.begin_create( @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseCreate.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseCreate.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create.py index 2ae500b7f0dc..08a02daaebf9 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.databases.begin_create( @@ -36,10 +36,8 @@ def main(): database_name="default", parameters={ "properties": { - "accessKeysAuthentication": "Enabled", "clientProtocol": "Encrypted", "clusteringPolicy": "EnterpriseCluster", - "deferUpgrade": "NotDeferred", "evictionPolicy": "AllKeysLRU", "modules": [ {"args": "ERROR_RATE 0.00 INITIAL_SIZE 400", "name": "RedisBloom"}, @@ -54,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesCreate.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesCreate.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create_with_geo_replication.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create_with_geo_replication.py index 980cfb56a759..74ff5a7f9d6e 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create_with_geo_replication.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_create_with_geo_replication.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid1", ) response = client.databases.begin_create( @@ -36,7 +36,6 @@ def main(): database_name="default", parameters={ "properties": { - "accessKeysAuthentication": "Enabled", "clientProtocol": "Encrypted", "clusteringPolicy": "EnterpriseCluster", "evictionPolicy": "NoEviction", @@ -44,10 +43,10 @@ def main(): "groupNickname": "groupName", "linkedDatabases": [ { - "id": "/subscriptions/e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default" + "id": "/subscriptions/subid1/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default" }, { - "id": "/subscriptions/e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8e/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default" + "id": "/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default" }, ], }, @@ -58,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesCreateWithGeoReplication.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesCreateWithGeoReplication.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_delete.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_delete.py index 3aafad90049a..8f5d15ca5f4c 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_delete.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_delete.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) client.databases.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesDelete.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesDelete.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_export.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_export.py index ea450c7196d7..938a15f56974 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_export.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_export.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) client.databases.begin_export( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesExport.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesExport.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_flush.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_flush.py index 07b26f0ebd28..7725655b47da 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_flush.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_flush.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) client.databases.begin_flush( @@ -36,12 +36,12 @@ def main(): database_name="default", parameters={ "ids": [ - "/subscriptions/e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default" + "/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default" ] }, ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesFlush.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesFlush.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_link.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_link.py index f5f89301555a..09065b5fb7c0 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_link.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_link.py @@ -35,19 +35,21 @@ def main(): cluster_name="cache1", database_name="default", parameters={ - "groupNickname": "groupName", - "linkedDatabases": [ - { - "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default" - }, - { - "id": "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default" - }, - ], + "geoReplication": { + "groupNickname": "groupName", + "linkedDatabases": [ + { + "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.Cache/redisEnterprise/cache1/databases/default" + }, + { + "id": "/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default" + }, + ], + } }, ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesForceLink.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesForceLink.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_unlink.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_unlink.py index ba1db1f41975..9e71fcdea7bd 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_unlink.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_force_unlink.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) client.databases.begin_force_unlink( @@ -36,12 +36,12 @@ def main(): database_name="default", parameters={ "ids": [ - "/subscriptions/e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default" + "/subscriptions/subid2/resourceGroups/rg2/providers/Microsoft.Cache/redisEnterprise/cache2/databases/default" ] }, ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesForceUnlink.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesForceUnlink.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_get.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_get.py index c9d741cd56b5..9a3feca757f5 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_get.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_get.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.databases.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesGet.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesGet.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_import.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_import.py index 27e0b4f483a2..eec41f448a76 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_import.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_import.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) client.databases.begin_import_method( @@ -43,6 +43,6 @@ def main(): ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesImport.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesImport.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_by_cluster.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_by_cluster.py index 7c7c9d4648c6..b95145e14fbe 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_by_cluster.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_by_cluster.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.databases.list_by_cluster( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesListByCluster.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesListByCluster.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_keys.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_keys.py index b82d05905189..aa838dcf7d0c 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_keys.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_list_keys.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.databases.list_keys( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesListKeys.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesListKeys.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_regenerate_key.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_regenerate_key.py index 3358fd7c4426..9ecf14a9530a 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_regenerate_key.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_regenerate_key.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.databases.begin_regenerate_key( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesRegenerateKey.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesRegenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_update.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_update.py index 6c4693d1cbe6..d2178248fc52 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_update.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_update.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.databases.begin_update( @@ -36,7 +36,6 @@ def main(): database_name="default", parameters={ "properties": { - "accessKeysAuthentication": "Enabled", "clientProtocol": "Encrypted", "evictionPolicy": "AllKeysLRU", "persistence": {"rdbEnabled": True, "rdbFrequency": "12h"}, @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesUpdate.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDatabasesUpdate.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_upgrade_db_redis_version.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_upgrade_db_redis_version.py deleted file mode 100644 index ad25605f6eaf..000000000000 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_databases_upgrade_db_redis_version.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.redisenterprise import RedisEnterpriseManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-redisenterprise -# USAGE - python redis_enterprise_databases_upgrade_db_redis_version.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = RedisEnterpriseManagementClient( - credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", - ) - - client.databases.begin_upgrade_db_redis_version( - resource_group_name="rg1", - cluster_name="cache1", - database_name="default", - ).result() - - -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDatabasesUpgradeDBRedisVersion.json -if __name__ == "__main__": - main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete.py index fa1b8f2453d9..0628f94ebddb 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) client.redis_enterprise.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDelete.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDelete.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete_private_endpoint_connection.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete_private_endpoint_connection.py index 7cc5fd8213d3..988cfed6d5ae 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete_private_endpoint_connection.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_delete_private_endpoint_connection.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) client.private_endpoint_connections.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseDeletePrivateEndpointConnection.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseDeletePrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get.py index 47af334ebb66..95d78d7e4078 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.redis_enterprise.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseGet.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseGet.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get_private_endpoint_connection.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get_private_endpoint_connection.py index 15857dae1749..2c8503cc157a 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get_private_endpoint_connection.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_get_private_endpoint_connection.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.private_endpoint_connections.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseGetPrivateEndpointConnection.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseGetPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list.py index c80ddda19b8d..a42c2b16a4ff 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.redis_enterprise.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseList.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseList.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_by_resource_group.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_by_resource_group.py index 259e0f87123d..1ff021230cc6 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_by_resource_group.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_by_resource_group.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.redis_enterprise.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseListByResourceGroup.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_endpoint_connections.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_endpoint_connections.py index 34cd59ea442f..7d366dc5b34c 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_endpoint_connections.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_endpoint_connections.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.private_endpoint_connections.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseListPrivateEndpointConnections.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseListPrivateEndpointConnections.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_link_resources.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_link_resources.py index 3b96921a9fb7..184a8d7696ba 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_link_resources.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_list_private_link_resources.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.private_link_resources.list_by_cluster( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseListPrivateLinkResources.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_put_private_endpoint_connection.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_put_private_endpoint_connection.py index e7f62637cd99..8ccffa3a219b 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_put_private_endpoint_connection.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_put_private_endpoint_connection.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.private_endpoint_connections.begin_put( @@ -41,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterprisePutPrivateEndpointConnection.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterprisePutPrivateEndpointConnection.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_update.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_update.py index 0f572d902087..18690a817c8d 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_update.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_samples/redis_enterprise_update.py @@ -27,7 +27,7 @@ def main(): client = RedisEnterpriseManagementClient( credential=DefaultAzureCredential(), - subscription_id="e7b5a9d2-6b6a-4d2f-9143-20d9a10f5b8f", + subscription_id="subid", ) response = client.redis_enterprise.begin_update( @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/preview/2024-09-01-preview/examples/RedisEnterpriseUpdate.json +# x-ms-original-file: specification/redisenterprise/resource-manager/Microsoft.Cache/stable/2025-04-01/examples/RedisEnterpriseUpdate.json if __name__ == "__main__": main() diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/conftest.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/conftest.py index 3880ade3dfe4..56ab2f076ab4 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/conftest.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/conftest.py @@ -18,7 +18,7 @@ load_dotenv() -# aovid record sensitive identity information in recordings +# For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): redisenterprisemanagement_subscription_id = os.environ.get( diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_databases_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_databases_operations.py index 55d71791c0e5..836fc24dded9 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_databases_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_databases_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_cluster(self, resource_group): + def test_databases_list_by_cluster(self, resource_group): response = self.client.databases.list_by_cluster( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,16 +32,14 @@ def test_list_by_cluster(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create(self, resource_group): + def test_databases_begin_create(self, resource_group): response = self.client.databases.begin_create( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={ - "accessKeysAuthentication": "str", "clientProtocol": "str", "clusteringPolicy": "str", - "deferUpgrade": "str", "evictionPolicy": "str", "geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]}, "id": "str", @@ -50,19 +48,10 @@ def test_begin_create(self, resource_group): "persistence": {"aofEnabled": bool, "aofFrequency": "str", "rdbEnabled": bool, "rdbFrequency": "str"}, "port": 0, "provisioningState": "str", - "redisVersion": "str", "resourceState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -70,26 +59,23 @@ def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_databases_begin_update(self, resource_group): response = self.client.databases.begin_update( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={ - "accessKeysAuthentication": "str", "clientProtocol": "str", "clusteringPolicy": "str", - "deferUpgrade": "str", "evictionPolicy": "str", "geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]}, "modules": [{"name": "str", "args": "str", "version": "str"}], "persistence": {"aofEnabled": bool, "aofFrequency": "str", "rdbEnabled": bool, "rdbFrequency": "str"}, "port": 0, "provisioningState": "str", - "redisVersion": "str", "resourceState": "str", }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -97,12 +83,12 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_databases_get(self, resource_group): response = self.client.databases.get( resource_group_name=resource_group.name, cluster_name="str", database_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself @@ -110,12 +96,12 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_databases_begin_delete(self, resource_group): response = self.client.databases.begin_delete( resource_group_name=resource_group.name, cluster_name="str", database_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -123,12 +109,12 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_keys(self, resource_group): + def test_databases_list_keys(self, resource_group): response = self.client.databases.list_keys( resource_group_name=resource_group.name, cluster_name="str", database_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself @@ -136,13 +122,13 @@ def test_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_regenerate_key(self, resource_group): + def test_databases_begin_regenerate_key(self, resource_group): response = self.client.databases.begin_regenerate_key( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"keyType": "str"}, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -150,13 +136,13 @@ def test_begin_regenerate_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_import_method(self, resource_group): + def test_databases_begin_import_method(self, resource_group): response = self.client.databases.begin_import_method( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"sasUris": ["str"]}, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -164,13 +150,13 @@ def test_begin_import_method(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_export(self, resource_group): + def test_databases_begin_export(self, resource_group): response = self.client.databases.begin_export( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"sasUri": "str"}, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -178,13 +164,13 @@ def test_begin_export(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_force_unlink(self, resource_group): + def test_databases_begin_force_unlink(self, resource_group): response = self.client.databases.begin_force_unlink( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"ids": ["str"]}, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -192,13 +178,13 @@ def test_begin_force_unlink(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_force_link_to_replication_group(self, resource_group): + def test_databases_begin_force_link_to_replication_group(self, resource_group): response = self.client.databases.begin_force_link_to_replication_group( resource_group_name=resource_group.name, cluster_name="str", database_name="str", - parameters={"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]}, - api_version="2024-09-01-preview", + parameters={"geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]}}, + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -206,26 +192,13 @@ def test_begin_force_link_to_replication_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_flush(self, resource_group): + def test_databases_begin_flush(self, resource_group): response = self.client.databases.begin_flush( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"ids": ["str"]}, - api_version="2024-09-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_begin_upgrade_db_redis_version(self, resource_group): - response = self.client.databases.begin_upgrade_db_redis_version( - resource_group_name=resource_group.name, - cluster_name="str", - database_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_databases_operations_async.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_databases_operations_async.py index 17c9934b83d9..8688b5bef888 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_databases_operations_async.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_databases_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_cluster(self, resource_group): + async def test_databases_list_by_cluster(self, resource_group): response = self.client.databases.list_by_cluster( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,17 +33,15 @@ async def test_list_by_cluster(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create(self, resource_group): + async def test_databases_begin_create(self, resource_group): response = await ( await self.client.databases.begin_create( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={ - "accessKeysAuthentication": "str", "clientProtocol": "str", "clusteringPolicy": "str", - "deferUpgrade": "str", "evictionPolicy": "str", "geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]}, "id": "str", @@ -57,19 +55,10 @@ async def test_begin_create(self, resource_group): }, "port": 0, "provisioningState": "str", - "redisVersion": "str", "resourceState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, "type": "str", }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -78,17 +67,15 @@ async def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_databases_begin_update(self, resource_group): response = await ( await self.client.databases.begin_update( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={ - "accessKeysAuthentication": "str", "clientProtocol": "str", "clusteringPolicy": "str", - "deferUpgrade": "str", "evictionPolicy": "str", "geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]}, "modules": [{"name": "str", "args": "str", "version": "str"}], @@ -100,10 +87,9 @@ async def test_begin_update(self, resource_group): }, "port": 0, "provisioningState": "str", - "redisVersion": "str", "resourceState": "str", }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -112,12 +98,12 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_databases_get(self, resource_group): response = await self.client.databases.get( resource_group_name=resource_group.name, cluster_name="str", database_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself @@ -125,13 +111,13 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_databases_begin_delete(self, resource_group): response = await ( await self.client.databases.begin_delete( resource_group_name=resource_group.name, cluster_name="str", database_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -140,12 +126,12 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_keys(self, resource_group): + async def test_databases_list_keys(self, resource_group): response = await self.client.databases.list_keys( resource_group_name=resource_group.name, cluster_name="str", database_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself @@ -153,14 +139,14 @@ async def test_list_keys(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_regenerate_key(self, resource_group): + async def test_databases_begin_regenerate_key(self, resource_group): response = await ( await self.client.databases.begin_regenerate_key( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"keyType": "str"}, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -169,14 +155,14 @@ async def test_begin_regenerate_key(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_import_method(self, resource_group): + async def test_databases_begin_import_method(self, resource_group): response = await ( await self.client.databases.begin_import_method( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"sasUris": ["str"]}, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -185,14 +171,14 @@ async def test_begin_import_method(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_export(self, resource_group): + async def test_databases_begin_export(self, resource_group): response = await ( await self.client.databases.begin_export( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"sasUri": "str"}, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -201,14 +187,14 @@ async def test_begin_export(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_force_unlink(self, resource_group): + async def test_databases_begin_force_unlink(self, resource_group): response = await ( await self.client.databases.begin_force_unlink( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"ids": ["str"]}, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -217,14 +203,16 @@ async def test_begin_force_unlink(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_force_link_to_replication_group(self, resource_group): + async def test_databases_begin_force_link_to_replication_group(self, resource_group): response = await ( await self.client.databases.begin_force_link_to_replication_group( resource_group_name=resource_group.name, cluster_name="str", database_name="str", - parameters={"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]}, - api_version="2024-09-01-preview", + parameters={ + "geoReplication": {"groupNickname": "str", "linkedDatabases": [{"id": "str", "state": "str"}]} + }, + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -233,29 +221,14 @@ async def test_begin_force_link_to_replication_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_flush(self, resource_group): + async def test_databases_begin_flush(self, resource_group): response = await ( await self.client.databases.begin_flush( resource_group_name=resource_group.name, cluster_name="str", database_name="str", parameters={"ids": ["str"]}, - api_version="2024-09-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_begin_upgrade_db_redis_version(self, resource_group): - response = await ( - await self.client.databases.begin_upgrade_db_redis_version( - resource_group_name=resource_group.name, - cluster_name="str", - database_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations.py index 197828d50e5b..8084f4980686 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations.py @@ -20,9 +20,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_async.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_async.py index c6f7f2b9c06d..853e466c82b1 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_async.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_async.py @@ -21,9 +21,9 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_operations_list(self, resource_group): response = self.client.operations.list( - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_status_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_status_operations.py index 6d2cbea22e7c..4b6f0c2e81ef 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_status_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_status_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_operations_status_get(self, resource_group): response = self.client.operations_status.get( location="str", operation_id="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_status_operations_async.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_status_operations_async.py index df578eedf1ad..04860e62aaeb 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_status_operations_async.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_operations_status_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_operations_status_get(self, resource_group): response = await self.client.operations_status.get( location="str", operation_id="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_endpoint_connections_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_endpoint_connections_operations.py index 15d8367f20cd..5c908a8217d0 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_endpoint_connections_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_endpoint_connections_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_private_endpoint_connections_list(self, resource_group): response = self.client.private_endpoint_connections.list( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,12 +32,12 @@ def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_private_endpoint_connections_get(self, resource_group): response = self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, cluster_name="str", private_endpoint_connection_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_put(self, resource_group): + def test_private_endpoint_connections_begin_put(self, resource_group): response = self.client.private_endpoint_connections.begin_put( resource_group_name=resource_group.name, cluster_name="str", @@ -58,7 +58,7 @@ def test_begin_put(self, resource_group): "provisioningState": "str", "type": "str", }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -66,12 +66,12 @@ def test_begin_put(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_private_endpoint_connections_begin_delete(self, resource_group): response = self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, cluster_name="str", private_endpoint_connection_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_endpoint_connections_operations_async.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_endpoint_connections_operations_async.py index 29b4189507e1..c646734f4735 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_endpoint_connections_operations_async.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_endpoint_connections_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_private_endpoint_connections_list(self, resource_group): response = self.client.private_endpoint_connections.list( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,12 +33,12 @@ async def test_list(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_private_endpoint_connections_get(self, resource_group): response = await self.client.private_endpoint_connections.get( resource_group_name=resource_group.name, cluster_name="str", private_endpoint_connection_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_put(self, resource_group): + async def test_private_endpoint_connections_begin_put(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_put( resource_group_name=resource_group.name, @@ -64,7 +64,7 @@ async def test_begin_put(self, resource_group): "provisioningState": "str", "type": "str", }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -73,13 +73,13 @@ async def test_begin_put(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_private_endpoint_connections_begin_delete(self, resource_group): response = await ( await self.client.private_endpoint_connections.begin_delete( resource_group_name=resource_group.name, cluster_name="str", private_endpoint_connection_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_link_resources_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_link_resources_operations.py index 34372b6327a6..aa8d60cc3d01 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_link_resources_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_link_resources_operations.py @@ -20,11 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_cluster(self, resource_group): + def test_private_link_resources_list_by_cluster(self, resource_group): response = self.client.private_link_resources.list_by_cluster( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_link_resources_operations_async.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_link_resources_operations_async.py index 058e8b6e4fea..3a0f201303fe 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_link_resources_operations_async.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_private_link_resources_operations_async.py @@ -21,11 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_cluster(self, resource_group): + async def test_private_link_resources_list_by_cluster(self, resource_group): response = self.client.private_link_resources.list_by_cluster( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_redis_enterprise_operations.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_redis_enterprise_operations.py index 0a2a0ba58741..39e9a8d5d1a7 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_redis_enterprise_operations.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_redis_enterprise_operations.py @@ -20,7 +20,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_create(self, resource_group): + def test_redis_enterprise_begin_create(self, resource_group): response = self.client.redis_enterprise.begin_create( resource_group_name=resource_group.name, cluster_name="str", @@ -33,7 +33,6 @@ def test_begin_create(self, resource_group): "keyEncryptionKeyUrl": "str", } }, - "highAvailability": "str", "hostName": "str", "id": "str", "identity": { @@ -60,13 +59,12 @@ def test_begin_create(self, resource_group): ], "provisioningState": "str", "redisVersion": "str", - "redundancyMode": "str", "resourceState": "str", "tags": {"str": "str"}, "type": "str", "zones": ["str"], }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -74,7 +72,7 @@ def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_update(self, resource_group): + def test_redis_enterprise_begin_update(self, resource_group): response = self.client.redis_enterprise.begin_update( resource_group_name=resource_group.name, cluster_name="str", @@ -85,7 +83,6 @@ def test_begin_update(self, resource_group): "keyEncryptionKeyUrl": "str", } }, - "highAvailability": "str", "hostName": "str", "identity": { "type": "str", @@ -110,12 +107,11 @@ def test_begin_update(self, resource_group): ], "provisioningState": "str", "redisVersion": "str", - "redundancyMode": "str", "resourceState": "str", "sku": {"name": "str", "capacity": 0}, "tags": {"str": "str"}, }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -123,11 +119,11 @@ def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_begin_delete(self, resource_group): + def test_redis_enterprise_begin_delete(self, resource_group): response = self.client.redis_enterprise.begin_delete( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -135,11 +131,11 @@ def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_get(self, resource_group): + def test_redis_enterprise_get(self, resource_group): response = self.client.redis_enterprise.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself @@ -147,10 +143,10 @@ def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list_by_resource_group(self, resource_group): + def test_redis_enterprise_list_by_resource_group(self, resource_group): response = self.client.redis_enterprise.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -158,9 +154,9 @@ def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_list(self, resource_group): + def test_redis_enterprise_list(self, resource_group): response = self.client.redis_enterprise.list( - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_redis_enterprise_operations_async.py b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_redis_enterprise_operations_async.py index dc424f716df0..32fbe80db452 100644 --- a/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_redis_enterprise_operations_async.py +++ b/sdk/redisenterprise/azure-mgmt-redisenterprise/generated_tests/test_redis_enterprise_management_redis_enterprise_operations_async.py @@ -21,7 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_create(self, resource_group): + async def test_redis_enterprise_begin_create(self, resource_group): response = await ( await self.client.redis_enterprise.begin_create( resource_group_name=resource_group.name, @@ -38,7 +38,6 @@ async def test_begin_create(self, resource_group): "keyEncryptionKeyUrl": "str", } }, - "highAvailability": "str", "hostName": "str", "id": "str", "identity": { @@ -65,13 +64,12 @@ async def test_begin_create(self, resource_group): ], "provisioningState": "str", "redisVersion": "str", - "redundancyMode": "str", "resourceState": "str", "tags": {"str": "str"}, "type": "str", "zones": ["str"], }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -80,7 +78,7 @@ async def test_begin_create(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_update(self, resource_group): + async def test_redis_enterprise_begin_update(self, resource_group): response = await ( await self.client.redis_enterprise.begin_update( resource_group_name=resource_group.name, @@ -95,7 +93,6 @@ async def test_begin_update(self, resource_group): "keyEncryptionKeyUrl": "str", } }, - "highAvailability": "str", "hostName": "str", "identity": { "type": "str", @@ -120,12 +117,11 @@ async def test_begin_update(self, resource_group): ], "provisioningState": "str", "redisVersion": "str", - "redundancyMode": "str", "resourceState": "str", "sku": {"name": "str", "capacity": 0}, "tags": {"str": "str"}, }, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -134,12 +130,12 @@ async def test_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_begin_delete(self, resource_group): + async def test_redis_enterprise_begin_delete(self, resource_group): response = await ( await self.client.redis_enterprise.begin_delete( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -148,11 +144,11 @@ async def test_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_get(self, resource_group): + async def test_redis_enterprise_get(self, resource_group): response = await self.client.redis_enterprise.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + api_version="2025-04-01", ) # please add some check logic here by yourself @@ -160,10 +156,10 @@ async def test_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list_by_resource_group(self, resource_group): + async def test_redis_enterprise_list_by_resource_group(self, resource_group): response = self.client.redis_enterprise.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -171,9 +167,9 @@ async def test_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_list(self, resource_group): + async def test_redis_enterprise_list(self, resource_group): response = self.client.redis_enterprise.list( - api_version="2024-09-01-preview", + api_version="2025-04-01", ) result = [r async for r in response] # please add some check logic here by yourself