From d8f08bd515f875fb9383bdf0e3fc4e2d1de1ebe8 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 13 May 2024 06:55:56 +0000 Subject: [PATCH] CodeGen from PR 28828 in Azure/azure-rest-api-specs Merge 5d9260bbcb383745865caad3b56099001e38598c into 0bc238ecc7d42a1c814ed076b84e7c6328ae39df --- .../azure-mgmt-elasticsan/_meta.json | 10 +- .../azure/mgmt/elasticsan/_configuration.py | 11 +- .../elasticsan/_elastic_san_mgmt_client.py | 28 +- .../azure/mgmt/elasticsan/_serialization.py | 90 +++--- .../azure/mgmt/elasticsan/_version.py | 2 +- .../mgmt/elasticsan/aio/_configuration.py | 11 +- .../aio/_elastic_san_mgmt_client.py | 30 +- .../operations/_elastic_sans_operations.py | 265 ++++++----------- .../elasticsan/aio/operations/_operations.py | 35 +-- ...private_endpoint_connections_operations.py | 158 ++++------ .../_private_link_resources_operations.py | 29 +- .../aio/operations/_skus_operations.py | 35 +-- .../operations/_volume_groups_operations.py | 229 +++++---------- .../_volume_snapshots_operations.py | 158 ++++------ .../aio/operations/_volumes_operations.py | 228 +++++--------- .../models/_elastic_san_mgmt_client_enums.py | 2 +- .../mgmt/elasticsan/models/_models_py3.py | 94 +++--- .../operations/_elastic_sans_operations.py | 277 ++++++------------ .../mgmt/elasticsan/operations/_operations.py | 37 +-- ...private_endpoint_connections_operations.py | 166 ++++------- .../_private_link_resources_operations.py | 31 +- .../elasticsan/operations/_skus_operations.py | 37 +-- .../operations/_volume_groups_operations.py | 239 +++++---------- .../_volume_snapshots_operations.py | 166 ++++------- .../operations/_volumes_operations.py | 238 +++++---------- .../elastic_sans_create_maximum_set_gen.py | 13 +- .../elastic_sans_create_minimum_set_gen.py | 45 --- .../elastic_sans_delete_maximum_set_gen.py | 3 +- .../elastic_sans_delete_minimum_set_gen.py | 40 --- .../elastic_sans_get_maximum_set_gen.py | 3 +- .../elastic_sans_get_minimum_set_gen.py | 41 --- ..._list_by_resource_group_maximum_set_gen.py | 3 +- ..._list_by_resource_group_minimum_set_gen.py | 3 +- ...ns_list_by_subscription_maximum_set_gen.py | 3 +- ...ns_list_by_subscription_minimum_set_gen.py | 3 +- .../elastic_sans_update_maximum_set_gen.py | 9 +- .../operations_list_maximum_set_gen.py | 3 +- .../operations_list_minimum_set_gen.py | 3 +- ...oint_connections_create_maximum_set_gen.py | 11 +- ...oint_connections_create_minimum_set_gen.py | 43 --- ...oint_connections_delete_maximum_set_gen.py | 3 +- ...oint_connections_delete_minimum_set_gen.py | 41 --- ...ndpoint_connections_get_maximum_set_gen.py | 3 +- ...ndpoint_connections_get_minimum_set_gen.py | 42 --- ...dpoint_connections_list_maximum_set_gen.py | 3 +- ...dpoint_connections_list_minimum_set_gen.py | 42 --- ...ces_list_by_elastic_san_maximum_set_gen.py | 3 +- ...ces_list_by_elastic_san_minimum_set_gen.py | 41 --- .../skus_list_maximum_set_gen.py | 3 +- .../skus_list_minimum_set_gen.py | 3 +- .../volume_groups_create_maximum_set_gen.py | 27 +- .../volume_groups_delete_maximum_set_gen.py | 3 +- .../volume_groups_delete_minimum_set_gen.py | 41 --- .../volume_groups_get_maximum_set_gen.py | 3 +- .../volume_groups_get_minimum_set_gen.py | 42 --- ...ups_list_by_elastic_san_maximum_set_gen.py | 3 +- ...ups_list_by_elastic_san_minimum_set_gen.py | 42 --- .../volume_groups_update_maximum_set_gen.py | 25 +- ...volume_snapshots_create_maximum_set_gen.py | 13 +- ...volume_snapshots_create_minimum_set_gen.py | 50 ---- ...volume_snapshots_delete_maximum_set_gen.py | 3 +- ...volume_snapshots_delete_minimum_set_gen.py | 42 --- .../volume_snapshots_get_maximum_set_gen.py | 3 +- .../volume_snapshots_get_minimum_set_gen.py | 43 --- ...ts_list_by_volume_group_maximum_set_gen.py | 3 +- ...ts_list_by_volume_group_minimum_set_gen.py | 43 --- .../volumes_create_maximum_set_gen.py | 11 +- .../volumes_create_minimum_set_gen.py | 44 --- .../volumes_delete_maximum_set_gen.py | 3 +- .../volumes_delete_minimum_set_gen.py | 42 --- .../volumes_get_maximum_set_gen.py | 3 +- .../volumes_get_minimum_set_gen.py | 43 --- ...es_list_by_volume_group_maximum_set_gen.py | 3 +- ...es_list_by_volume_group_minimum_set_gen.py | 43 --- .../volumes_update_maximum_set_gen.py | 7 +- sdk/elasticsan/azure-mgmt-elasticsan/setup.py | 6 +- 76 files changed, 1042 insertions(+), 2565 deletions(-) delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_create_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_delete_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_get_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_create_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_delete_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_get_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_list_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_link_resources_list_by_elastic_san_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_delete_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_get_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_list_by_elastic_san_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_create_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_delete_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_get_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_list_by_volume_group_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_create_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_delete_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_get_minimum_set_gen.py delete mode 100644 sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_list_by_volume_group_minimum_set_gen.py diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/_meta.json b/sdk/elasticsan/azure-mgmt-elasticsan/_meta.json index e09bc1adcd23..b328929d9e35 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/_meta.json +++ b/sdk/elasticsan/azure-mgmt-elasticsan/_meta.json @@ -1,11 +1,11 @@ { - "commit": "09e36d3ffae7fa6428cef8c86f2ad7caf4704e2c", + "commit": "8746e5fe7e4008e1c1796ef501167f6cbad10a67", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.16", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/elasticsan/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/elasticsan/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/elasticsan/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_configuration.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_configuration.py index e000042acbec..dae38f28153e 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_configuration.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class ElasticSanMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ElasticSanMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ElasticSanMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class ElasticSanMgmtClientConfiguration(Configuration): # pylint: disable=too-m :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 "2023-01-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ElasticSanMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-01-01") + api_version: str = kwargs.pop("api_version", "2024-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-elasticsan/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_elastic_san_mgmt_client.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_elastic_san_mgmt_client.py index afbd7d5b0689..08227e76ced4 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_elastic_san_mgmt_client.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_elastic_san_mgmt_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import ElasticSanMgmtClientConfiguration @@ -58,7 +60,7 @@ class ElasticSanMgmtClient: # pylint: disable=client-accepts-api-version-keywor :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 "2023-01-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -75,7 +77,25 @@ def __init__( self._config = ElasticSanMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -96,7 +116,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -116,7 +136,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_serialization.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_serialization.py index 4bae2292227b..2f781d740827 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_serialization.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_version.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_version.py index c47f66669f1b..e5754a47ce68 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_version.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/_configuration.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/_configuration.py index cbd9306721db..896fbe5fd932 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/_configuration.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ElasticSanMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class ElasticSanMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ElasticSanMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class ElasticSanMgmtClientConfiguration(Configuration): # pylint: disable=too-m :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 "2023-01-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(ElasticSanMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2023-01-01") + api_version: str = kwargs.pop("api_version", "2024-05-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-elasticsan/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/_elastic_san_mgmt_client.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/_elastic_san_mgmt_client.py index de7d474a9034..78b6b2975f66 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/_elastic_san_mgmt_client.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/_elastic_san_mgmt_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ElasticSanMgmtClient: # pylint: disable=client-accepts-api-version-keywor :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 "2023-01-01". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-05-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -75,7 +77,25 @@ def __init__( self._config = ElasticSanMgmtClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -96,7 +116,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -116,7 +138,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_elastic_sans_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_elastic_sans_operations.py index 5f14fd0cf698..e19c7644791a 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_elastic_sans_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_elastic_sans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -40,6 +41,10 @@ build_update_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]] @@ -67,7 +72,6 @@ def __init__(self, *args, **kwargs) -> None: def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ElasticSan"]: """Gets a list of ElasticSans in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ElasticSan or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -78,7 +82,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ElasticS api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ElasticSanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,15 +93,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.ElasticS def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -109,13 +112,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ElasticSanList", pipeline_response) @@ -125,11 +128,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -142,10 +145,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.ElasticSan"]: """Gets a list of ElasticSan in a resource group. @@ -153,7 +152,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ElasticSan or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -164,7 +162,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.ElasticSanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -175,16 +173,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -196,13 +193,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ElasticSanList", pipeline_response) @@ -212,11 +209,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -229,14 +226,14 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans" - } - async def _create_initial( - self, resource_group_name: str, elastic_san_name: str, parameters: Union[_models.ElasticSan, IO], **kwargs: Any + self, + resource_group_name: str, + elastic_san_name: str, + parameters: Union[_models.ElasticSan, IO[bytes]], + **kwargs: Any ) -> _models.ElasticSan: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -259,7 +256,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "ElasticSan") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, @@ -267,16 +264,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -297,10 +293,6 @@ async def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } - @overload async def begin_create( self, @@ -323,14 +315,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.ElasticSan] @@ -342,7 +326,7 @@ async def begin_create( self, resource_group_name: str, elastic_san_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -355,18 +339,10 @@ async def begin_create( :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str :param parameters: Elastic San object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.ElasticSan] @@ -375,7 +351,11 @@ async def begin_create( @distributed_trace_async async def begin_create( - self, resource_group_name: str, elastic_san_name: str, parameters: Union[_models.ElasticSan, IO], **kwargs: Any + self, + resource_group_name: str, + elastic_san_name: str, + parameters: Union[_models.ElasticSan, IO[bytes]], + **kwargs: Any ) -> AsyncLROPoller[_models.ElasticSan]: """Create ElasticSan. @@ -384,19 +364,9 @@ async def begin_create( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :param parameters: Elastic San object. Is either a ElasticSan type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.ElasticSan or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Elastic San object. Is either a ElasticSan type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.elasticsan.models.ElasticSan or IO[bytes] :return: An instance of AsyncLROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.ElasticSan] @@ -428,7 +398,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ElasticSan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -440,26 +410,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ElasticSan].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return AsyncLROPoller[_models.ElasticSan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, elastic_san_name: str, - parameters: Union[_models.ElasticSanUpdate, IO], + parameters: Union[_models.ElasticSanUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.ElasticSan]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -482,7 +450,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "ElasticSanUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, @@ -490,16 +458,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -518,13 +485,9 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -548,14 +511,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.ElasticSan] @@ -567,7 +522,7 @@ async def begin_update( self, resource_group_name: str, elastic_san_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -580,18 +535,10 @@ async def begin_update( :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str :param parameters: Elastic San object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.ElasticSan] @@ -603,7 +550,7 @@ async def begin_update( self, resource_group_name: str, elastic_san_name: str, - parameters: Union[_models.ElasticSanUpdate, IO], + parameters: Union[_models.ElasticSanUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ElasticSan]: """Update a Elastic San. @@ -613,20 +560,9 @@ async def begin_update( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :param parameters: Elastic San object. Is either a ElasticSanUpdate type or a IO type. + :param parameters: Elastic San object. Is either a ElasticSanUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.ElasticSanUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type parameters: ~azure.mgmt.elasticsan.models.ElasticSanUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.ElasticSan] @@ -658,7 +594,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ElasticSan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -670,22 +606,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.ElasticSan].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return AsyncLROPoller[_models.ElasticSan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, elastic_san_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -699,21 +633,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -728,11 +661,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -745,14 +674,6 @@ async def begin_delete( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -779,7 +700,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -790,17 +711,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, elastic_san_name: str, **kwargs: Any) -> _models.ElasticSan: @@ -811,12 +728,11 @@ async def get(self, resource_group_name: str, elastic_san_name: str, **kwargs: A :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ElasticSan or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.ElasticSan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -830,21 +746,20 @@ async def get(self, resource_group_name: str, elastic_san_name: str, **kwargs: A api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ElasticSan] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -857,10 +772,6 @@ async def get(self, resource_group_name: str, elastic_san_name: str, **kwargs: A deserialized = self._deserialize("ElasticSan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return deserialized # type: ignore diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_operations.py index 8ca29c53d8ae..0f7ec708a3a8 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import 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]] @@ -56,7 +61,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Gets a list of ElasticSan operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elasticsan.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -67,7 +71,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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,14 +82,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +100,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -113,11 +116,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +132,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ElasticSan/operations"} diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_private_endpoint_connections_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_private_endpoint_connections_operations.py index 0ae83eae5f80..2175b7ca7952 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ 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]] @@ -66,10 +71,10 @@ async def _create_initial( resource_group_name: str, elastic_san_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +97,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -101,16 +106,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -131,10 +135,6 @@ async def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - @overload async def begin_create( self, @@ -160,14 +160,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -181,7 +173,7 @@ async def begin_create( resource_group_name: str, elastic_san_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -196,18 +188,10 @@ async def begin_create( :param private_endpoint_connection_name: The name of the Private Endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Private Endpoint Connection Approval object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -221,7 +205,7 @@ async def begin_create( resource_group_name: str, elastic_san_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Update the state of specified private endpoint connection associated with the Elastic San. @@ -234,19 +218,8 @@ async def begin_create( :param private_endpoint_connection_name: The name of the Private Endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Private Endpoint Connection Approval object. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.elasticsan.models.PrivateEndpointConnection or IO[bytes] :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -280,7 +253,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -292,17 +265,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace_async async def get( @@ -317,12 +288,11 @@ async def get( :type elastic_san_name: str :param private_endpoint_connection_name: The name of the Private Endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -336,22 +306,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -364,18 +333,14 @@ async def get( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, elastic_san_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -389,22 +354,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -419,11 +383,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -438,14 +398,6 @@ async def begin_delete( :type elastic_san_name: str :param private_endpoint_connection_name: The name of the Private Endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -473,7 +425,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -484,17 +436,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list( @@ -507,7 +455,6 @@ def list( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: @@ -520,7 +467,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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -531,17 +478,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -553,13 +499,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -569,11 +515,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -585,7 +531,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections" - } diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_private_link_resources_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_private_link_resources_operations.py index b39f6f1f569b..965320de2d27 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_private_link_resources_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._private_link_resources_operations import build_list_by_elastic_san_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]] @@ -61,12 +66,11 @@ async def list_by_elastic_san( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,21 +84,20 @@ async def list_by_elastic_san( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_by_elastic_san_request( + _request = build_list_by_elastic_san_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_elastic_san.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -107,10 +110,6 @@ async def list_by_elastic_san( deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_elastic_san.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateLinkResources" - } + return deserialized # type: ignore diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_skus_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_skus_operations.py index 0b9ba7392992..39bfa5c8540e 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_skus_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_skus_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._skus_operations import 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]] @@ -61,7 +66,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m :param filter: Specify $filter='location eq :code:``' to filter on location. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SkuInformation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elasticsan.models.SkuInformation] :raises ~azure.core.exceptions.HttpResponseError: @@ -72,7 +76,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SkuInformationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -83,16 +87,15 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_m def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -104,13 +107,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("SkuInformationList", pipeline_response) @@ -120,11 +123,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -136,5 +139,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus"} diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volume_groups_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volume_groups_operations.py index 6f54c67ee071..37434e0f89aa 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volume_groups_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volume_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_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]] @@ -73,7 +78,6 @@ def list_by_elastic_san( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VolumeGroup or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elasticsan.models.VolumeGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -84,7 +88,7 @@ def list_by_elastic_san( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VolumeGroupList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -95,17 +99,16 @@ def list_by_elastic_san( def prepare_request(next_link=None): if not next_link: - request = build_list_by_elastic_san_request( + _request = build_list_by_elastic_san_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_elastic_san.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -117,13 +120,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("VolumeGroupList", pipeline_response) @@ -133,11 +136,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,19 +153,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_elastic_san.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumeGroups" - } - async def _create_initial( self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: Union[_models.VolumeGroup, IO], + parameters: Union[_models.VolumeGroup, IO[bytes]], **kwargs: Any ) -> _models.VolumeGroup: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +184,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "VolumeGroup") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -194,16 +193,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -224,10 +222,6 @@ async def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } - @overload async def begin_create( self, @@ -253,14 +247,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -273,7 +259,7 @@ async def begin_create( resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -288,18 +274,10 @@ async def begin_create( :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str :param parameters: Volume Group object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -312,7 +290,7 @@ async def begin_create( resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: Union[_models.VolumeGroup, IO], + parameters: Union[_models.VolumeGroup, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.VolumeGroup]: """Create a Volume Group. @@ -324,19 +302,9 @@ async def begin_create( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :param parameters: Volume Group object. Is either a VolumeGroup type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.VolumeGroup or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Volume Group object. Is either a VolumeGroup type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.elasticsan.models.VolumeGroup or IO[bytes] :return: An instance of AsyncLROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -369,7 +337,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("VolumeGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -381,27 +349,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.VolumeGroup].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return AsyncLROPoller[_models.VolumeGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: Union[_models.VolumeGroupUpdate, IO], + parameters: Union[_models.VolumeGroupUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.VolumeGroup]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -424,7 +390,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "VolumeGroupUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -433,16 +399,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -461,13 +426,9 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -494,14 +455,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -514,7 +467,7 @@ async def begin_update( resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -529,18 +482,10 @@ async def begin_update( :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str :param parameters: Volume Group object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -553,7 +498,7 @@ async def begin_update( resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: Union[_models.VolumeGroupUpdate, IO], + parameters: Union[_models.VolumeGroupUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.VolumeGroup]: """Update an VolumeGroup. @@ -565,20 +510,9 @@ async def begin_update( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :param parameters: Volume Group object. Is either a VolumeGroupUpdate type or a IO type. + :param parameters: Volume Group object. Is either a VolumeGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.VolumeGroupUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type parameters: ~azure.mgmt.elasticsan.models.VolumeGroupUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -611,7 +545,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("VolumeGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -623,22 +557,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.VolumeGroup].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return AsyncLROPoller[_models.VolumeGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -652,22 +584,21 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -682,11 +613,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -701,14 +628,6 @@ async def begin_delete( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -736,7 +655,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -747,17 +666,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -772,12 +687,11 @@ async def get( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VolumeGroup or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.VolumeGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -791,22 +705,21 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VolumeGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -819,10 +732,6 @@ async def get( deserialized = self._deserialize("VolumeGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return deserialized # type: ignore diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volume_snapshots_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volume_snapshots_operations.py index 256818209764..5acca2f7ce2f 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volume_snapshots_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volume_snapshots_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -38,6 +39,10 @@ build_list_by_volume_group_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]] @@ -83,7 +88,6 @@ def list_by_volume_group( :param filter: Specify $filter='volumeName eq :code:``' to filter on volume. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elasticsan.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -94,7 +98,7 @@ def list_by_volume_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -105,19 +109,18 @@ def list_by_volume_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_volume_group_request( + _request = build_list_by_volume_group_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_volume_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -129,13 +132,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("SnapshotList", pipeline_response) @@ -145,11 +148,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -162,20 +165,16 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_volume_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots" - } - async def _create_initial( self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, snapshot_name: str, - parameters: Union[_models.Snapshot, IO], + parameters: Union[_models.Snapshot, IO[bytes]], **kwargs: Any ) -> _models.Snapshot: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -198,7 +197,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "Snapshot") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -208,16 +207,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -238,10 +236,6 @@ async def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } - @overload async def begin_create( self, @@ -270,14 +264,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Snapshot] @@ -291,7 +277,7 @@ async def begin_create( elastic_san_name: str, volume_group_name: str, snapshot_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -308,18 +294,10 @@ async def begin_create( :param snapshot_name: The name of the volume snapshot within the given volume group. Required. :type snapshot_name: str :param parameters: Snapshot object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Snapshot] @@ -333,7 +311,7 @@ async def begin_create( elastic_san_name: str, volume_group_name: str, snapshot_name: str, - parameters: Union[_models.Snapshot, IO], + parameters: Union[_models.Snapshot, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Snapshot]: """Create a Volume Snapshot. @@ -347,19 +325,8 @@ async def begin_create( :type volume_group_name: str :param snapshot_name: The name of the volume snapshot within the given volume group. Required. :type snapshot_name: str - :param parameters: Snapshot object. Is either a Snapshot type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.Snapshot or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Snapshot object. Is either a Snapshot type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.elasticsan.models.Snapshot or IO[bytes] :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Snapshot] @@ -393,7 +360,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Snapshot", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -405,22 +372,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Snapshot].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } + return AsyncLROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, snapshot_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -434,23 +399,22 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -465,11 +429,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -486,14 +446,6 @@ async def begin_delete( :type volume_group_name: str :param snapshot_name: The name of the volume snapshot within the given volume group. Required. :type snapshot_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -522,7 +474,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -533,17 +485,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -560,12 +508,11 @@ async def get( :type volume_group_name: str :param snapshot_name: The name of the volume snapshot within the given volume group. Required. :type snapshot_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -579,23 +526,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -608,10 +554,6 @@ async def get( deserialized = self._deserialize("Snapshot", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } + return deserialized # type: ignore diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volumes_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volumes_operations.py index 4b63587d30dc..07056e5d044b 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volumes_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/aio/operations/_volumes_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -39,6 +40,10 @@ build_update_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]] @@ -68,10 +73,10 @@ async def _create_initial( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: Union[_models.Volume, IO], + parameters: Union[_models.Volume, IO[bytes]], **kwargs: Any ) -> _models.Volume: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +99,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "Volume") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -104,16 +109,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -134,10 +138,6 @@ async def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } - @overload async def begin_create( self, @@ -166,14 +166,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Volume] @@ -187,7 +179,7 @@ async def begin_create( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -204,18 +196,10 @@ async def begin_create( :param volume_name: The name of the Volume. Required. :type volume_name: str :param parameters: Volume object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Volume] @@ -229,7 +213,7 @@ async def begin_create( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: Union[_models.Volume, IO], + parameters: Union[_models.Volume, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Volume]: """Create a Volume. @@ -243,19 +227,8 @@ async def begin_create( :type volume_group_name: str :param volume_name: The name of the Volume. Required. :type volume_name: str - :param parameters: Volume object. Is either a Volume type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.Volume or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Volume object. Is either a Volume type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.elasticsan.models.Volume or IO[bytes] :return: An instance of AsyncLROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Volume] @@ -289,7 +262,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Volume", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -301,17 +274,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Volume].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return AsyncLROPoller[_models.Volume]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _update_initial( self, @@ -319,10 +290,10 @@ async def _update_initial( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: Union[_models.VolumeUpdate, IO], + parameters: Union[_models.VolumeUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.Volume]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -345,7 +316,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "VolumeUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -355,16 +326,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -383,13 +353,9 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -419,14 +385,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Volume] @@ -440,7 +398,7 @@ async def begin_update( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -457,18 +415,10 @@ async def begin_update( :param volume_name: The name of the Volume. Required. :type volume_name: str :param parameters: Volume object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Volume] @@ -482,7 +432,7 @@ async def begin_update( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: Union[_models.VolumeUpdate, IO], + parameters: Union[_models.VolumeUpdate, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.Volume]: """Update an Volume. @@ -496,19 +446,8 @@ async def begin_update( :type volume_group_name: str :param volume_name: The name of the Volume. Required. :type volume_name: str - :param parameters: Volume object. Is either a VolumeUpdate type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.VolumeUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Volume object. Is either a VolumeUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.elasticsan.models.VolumeUpdate or IO[bytes] :return: An instance of AsyncLROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.elasticsan.models.Volume] @@ -542,7 +481,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Volume", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -554,17 +493,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.Volume].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return AsyncLROPoller[_models.Volume]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -576,7 +513,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements x_ms_force_delete: Optional[Union[str, _models.XMsForceDelete]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -590,7 +527,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -599,16 +536,15 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements x_ms_delete_snapshots=x_ms_delete_snapshots, x_ms_force_delete=x_ms_force_delete, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -623,11 +559,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -659,14 +591,6 @@ async def begin_delete( value are only true or false. Default value is false. Known values are: "true" and "false". Default value is None. :type x_ms_force_delete: str or ~azure.mgmt.elasticsan.models.XMsForceDelete - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -697,7 +621,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -708,17 +632,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get( @@ -735,12 +655,11 @@ async def get( :type volume_group_name: str :param volume_name: The name of the Volume. Required. :type volume_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Volume or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.Volume :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -754,23 +673,22 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Volume] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, volume_name=volume_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -783,13 +701,9 @@ async def get( deserialized = self._deserialize("Volume", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return deserialized # type: ignore @distributed_trace def list_by_volume_group( @@ -804,7 +718,6 @@ def list_by_volume_group( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Volume or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.elasticsan.models.Volume] :raises ~azure.core.exceptions.HttpResponseError: @@ -815,7 +728,7 @@ def list_by_volume_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VolumeList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -826,18 +739,17 @@ def list_by_volume_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_volume_group_request( + _request = build_list_by_volume_group_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_volume_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -849,13 +761,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("VolumeList", pipeline_response) @@ -865,11 +777,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -881,7 +793,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list_by_volume_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes" - } diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/models/_elastic_san_mgmt_client_enums.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/models/_elastic_san_mgmt_client_enums.py index 5e80730c84d4..8d285dc4d2ca 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/models/_elastic_san_mgmt_client_enums.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/models/_elastic_san_mgmt_client_enums.py @@ -38,7 +38,7 @@ class EncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Volume is encrypted at rest with Platform managed key. It is the default encryption type.""" ENCRYPTION_AT_REST_WITH_CUSTOMER_MANAGED_KEY = "EncryptionAtRestWithCustomerManagedKey" """Volume is encrypted at rest with Customer managed key that can be changed and revoked by a - #: customer.""" + customer.""" class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/models/_models_py3.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/models/_models_py3.py index d9fabec0a947..7d76d0f971f3 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/models/_models_py3.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/models/_models_py3.py @@ -23,7 +23,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -64,10 +64,10 @@ class TrackedResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -117,10 +117,10 @@ class ElasticSan(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -212,7 +212,7 @@ class ElasticSanProperties(_serialization.Model): # pylint: disable=too-many-in Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar sku: resource sku. Required. :vartype sku: ~azure.mgmt.elasticsan.models.Sku @@ -538,7 +538,7 @@ class Identity(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar principal_id: The principal ID of resource identity. :vartype principal_id: str @@ -898,10 +898,10 @@ class PrivateEndpointConnection(Resource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -975,7 +975,7 @@ class PrivateEndpointConnectionProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar provisioning_state: Provisioning State of Private Endpoint connection resource. Known values are: "Invalid", "Succeeded", "Failed", "Canceled", "Pending", "Creating", "Updating", @@ -1036,7 +1036,7 @@ class PrivateLinkResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1189,7 +1189,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1201,29 +1201,11 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.elasticsan.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) - class Sku(_serialization.Model): """The SKU name. Required for account creation; optional for update. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The sku name. Required. Known values are: "Premium_LRS" and "Premium_ZRS". :vartype name: str or ~azure.mgmt.elasticsan.models.SkuName @@ -1291,7 +1273,7 @@ class SkuInformation(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: Sku Name. Required. Known values are: "Premium_LRS" and "Premium_ZRS". :vartype name: str or ~azure.mgmt.elasticsan.models.SkuName @@ -1408,10 +1390,10 @@ class Snapshot(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1453,10 +1435,10 @@ def __init__(self, *, properties: "_models.SnapshotProperties", **kwargs: Any) - class SnapshotCreationData(_serialization.Model): """Data used when creating a volume snapshot. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar source_id: Fully qualified resource ID of the volume. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". # pylint: disable=line-too-long Required. :vartype source_id: str """ @@ -1472,7 +1454,7 @@ class SnapshotCreationData(_serialization.Model): def __init__(self, *, source_id: str, **kwargs: Any) -> None: """ :keyword source_id: Fully qualified resource ID of the volume. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}". # pylint: disable=line-too-long Required. :paramtype source_id: str """ @@ -1515,7 +1497,7 @@ class SnapshotProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar creation_data: Data used when creating a volume snapshot. Required. :vartype creation_data: ~azure.mgmt.elasticsan.models.SnapshotCreationData @@ -1561,7 +1543,7 @@ class SourceCreationData(_serialization.Model): are: "None", "VolumeSnapshot", "DiskSnapshot", "Disk", and "DiskRestorePoint". :vartype create_source: str or ~azure.mgmt.elasticsan.models.VolumeCreateOption :ivar source_id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype source_id: str """ @@ -1582,7 +1564,7 @@ def __init__( are: "None", "VolumeSnapshot", "DiskSnapshot", "Disk", and "DiskRestorePoint". :paramtype create_source: str or ~azure.mgmt.elasticsan.models.VolumeCreateOption :keyword source_id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :paramtype source_id: str """ super().__init__(**kwargs) @@ -1685,10 +1667,10 @@ def __init__(self, **kwargs: Any) -> None: class VirtualNetworkRule(_serialization.Model): """Virtual Network rule. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar virtual_network_resource_id: Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. # pylint: disable=line-too-long Required. :vartype virtual_network_resource_id: str :ivar action: The action of virtual network rule. "Allow" @@ -1709,7 +1691,7 @@ def __init__( ) -> None: """ :keyword virtual_network_resource_id: Resource ID of a subnet, for example: - /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. + /subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}. # pylint: disable=line-too-long Required. :paramtype virtual_network_resource_id: str :keyword action: The action of virtual network rule. "Allow" @@ -1725,10 +1707,10 @@ class Volume(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1773,7 +1755,7 @@ class VolumeGroup(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -1875,6 +1857,9 @@ class VolumeGroupProperties(_serialization.Model): :ivar private_endpoint_connections: The list of Private Endpoint Connections. :vartype private_endpoint_connections: list[~azure.mgmt.elasticsan.models.PrivateEndpointConnection] + :ivar enforce_data_integrity_check_for_iscsi: A boolean indicating whether or not Data + Integrity Check is enabled. + :vartype enforce_data_integrity_check_for_iscsi: bool """ _validation = { @@ -1889,6 +1874,7 @@ class VolumeGroupProperties(_serialization.Model): "encryption_properties": {"key": "encryptionProperties", "type": "EncryptionProperties"}, "network_acls": {"key": "networkAcls", "type": "NetworkRuleSet"}, "private_endpoint_connections": {"key": "privateEndpointConnections", "type": "[PrivateEndpointConnection]"}, + "enforce_data_integrity_check_for_iscsi": {"key": "enforceDataIntegrityCheckForIscsi", "type": "bool"}, } def __init__( @@ -1898,6 +1884,7 @@ def __init__( encryption: Optional[Union[str, "_models.EncryptionType"]] = None, encryption_properties: Optional["_models.EncryptionProperties"] = None, network_acls: Optional["_models.NetworkRuleSet"] = None, + enforce_data_integrity_check_for_iscsi: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -1912,6 +1899,9 @@ def __init__( :keyword network_acls: A collection of rules governing the accessibility from specific network locations. :paramtype network_acls: ~azure.mgmt.elasticsan.models.NetworkRuleSet + :keyword enforce_data_integrity_check_for_iscsi: A boolean indicating whether or not Data + Integrity Check is enabled. + :paramtype enforce_data_integrity_check_for_iscsi: bool """ super().__init__(**kwargs) self.provisioning_state = None @@ -1920,6 +1910,7 @@ def __init__( self.encryption_properties = encryption_properties self.network_acls = network_acls self.private_endpoint_connections = None + self.enforce_data_integrity_check_for_iscsi = enforce_data_integrity_check_for_iscsi class VolumeGroupUpdate(_serialization.Model): @@ -1968,6 +1959,9 @@ class VolumeGroupUpdateProperties(_serialization.Model): :ivar network_acls: A collection of rules governing the accessibility from specific network locations. :vartype network_acls: ~azure.mgmt.elasticsan.models.NetworkRuleSet + :ivar enforce_data_integrity_check_for_iscsi: A boolean indicating whether or not Data + Integrity Check is enabled. + :vartype enforce_data_integrity_check_for_iscsi: bool """ _attribute_map = { @@ -1975,6 +1969,7 @@ class VolumeGroupUpdateProperties(_serialization.Model): "encryption": {"key": "encryption", "type": "str"}, "encryption_properties": {"key": "encryptionProperties", "type": "EncryptionProperties"}, "network_acls": {"key": "networkAcls", "type": "NetworkRuleSet"}, + "enforce_data_integrity_check_for_iscsi": {"key": "enforceDataIntegrityCheckForIscsi", "type": "bool"}, } def __init__( @@ -1984,6 +1979,7 @@ def __init__( encryption: Optional[Union[str, "_models.EncryptionType"]] = None, encryption_properties: Optional["_models.EncryptionProperties"] = None, network_acls: Optional["_models.NetworkRuleSet"] = None, + enforce_data_integrity_check_for_iscsi: Optional[bool] = None, **kwargs: Any ) -> None: """ @@ -1998,12 +1994,16 @@ def __init__( :keyword network_acls: A collection of rules governing the accessibility from specific network locations. :paramtype network_acls: ~azure.mgmt.elasticsan.models.NetworkRuleSet + :keyword enforce_data_integrity_check_for_iscsi: A boolean indicating whether or not Data + Integrity Check is enabled. + :paramtype enforce_data_integrity_check_for_iscsi: bool """ super().__init__(**kwargs) self.protocol_type = protocol_type self.encryption = encryption self.encryption_properties = encryption_properties self.network_acls = network_acls + self.enforce_data_integrity_check_for_iscsi = enforce_data_integrity_check_for_iscsi class VolumeList(_serialization.Model): @@ -2041,7 +2041,7 @@ class VolumeProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar volume_id: Unique Id of the volume in GUID format. :vartype volume_id: str diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_elastic_sans_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_elastic_sans_operations.py index 529c34fdc7ab..1e10909c2494 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_elastic_sans_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_elastic_sans_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +72,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -99,7 +104,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +147,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -185,7 +190,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -225,7 +230,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -282,7 +287,6 @@ def __init__(self, *args, **kwargs): def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ElasticSan"]: """Gets a list of ElasticSans in a subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ElasticSan or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -293,7 +297,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ElasticSan"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ElasticSanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -304,15 +308,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.ElasticSan"]: def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -324,13 +327,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ElasticSanList", pipeline_response) @@ -340,11 +343,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -357,10 +360,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/elasticSans" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ElasticSan"]: """Gets a list of ElasticSan in a resource group. @@ -368,7 +367,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ElasticSan or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -379,7 +377,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.ElasticSanList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -390,16 +388,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -411,13 +408,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ElasticSanList", pipeline_response) @@ -427,11 +424,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -444,14 +441,14 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans" - } - def _create_initial( - self, resource_group_name: str, elastic_san_name: str, parameters: Union[_models.ElasticSan, IO], **kwargs: Any + self, + resource_group_name: str, + elastic_san_name: str, + parameters: Union[_models.ElasticSan, IO[bytes]], + **kwargs: Any ) -> _models.ElasticSan: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -474,7 +471,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "ElasticSan") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, @@ -482,16 +479,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -512,10 +508,6 @@ def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } - @overload def begin_create( self, @@ -538,14 +530,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -556,7 +540,7 @@ def begin_create( self, resource_group_name: str, elastic_san_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -569,18 +553,10 @@ def begin_create( :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str :param parameters: Elastic San object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -588,7 +564,11 @@ def begin_create( @distributed_trace def begin_create( - self, resource_group_name: str, elastic_san_name: str, parameters: Union[_models.ElasticSan, IO], **kwargs: Any + self, + resource_group_name: str, + elastic_san_name: str, + parameters: Union[_models.ElasticSan, IO[bytes]], + **kwargs: Any ) -> LROPoller[_models.ElasticSan]: """Create ElasticSan. @@ -597,19 +577,9 @@ def begin_create( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :param parameters: Elastic San object. Is either a ElasticSan type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.ElasticSan or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Elastic San object. Is either a ElasticSan type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.elasticsan.models.ElasticSan or IO[bytes] :return: An instance of LROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -640,7 +610,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ElasticSan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -652,26 +622,24 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ElasticSan].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return LROPoller[_models.ElasticSan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, elastic_san_name: str, - parameters: Union[_models.ElasticSanUpdate, IO], + parameters: Union[_models.ElasticSanUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.ElasticSan]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -694,7 +662,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "ElasticSanUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, @@ -702,16 +670,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -730,13 +697,9 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -760,14 +723,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -778,7 +733,7 @@ def begin_update( self, resource_group_name: str, elastic_san_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -791,18 +746,10 @@ def begin_update( :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str :param parameters: Elastic San object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -813,7 +760,7 @@ def begin_update( self, resource_group_name: str, elastic_san_name: str, - parameters: Union[_models.ElasticSanUpdate, IO], + parameters: Union[_models.ElasticSanUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ElasticSan]: """Update a Elastic San. @@ -823,20 +770,9 @@ def begin_update( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :param parameters: Elastic San object. Is either a ElasticSanUpdate type or a IO type. + :param parameters: Elastic San object. Is either a ElasticSanUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.ElasticSanUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type parameters: ~azure.mgmt.elasticsan.models.ElasticSanUpdate or IO[bytes] :return: An instance of LROPoller that returns either ElasticSan or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.ElasticSan] :raises ~azure.core.exceptions.HttpResponseError: @@ -867,7 +803,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("ElasticSan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -879,22 +815,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.ElasticSan].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return LROPoller[_models.ElasticSan]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, elastic_san_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -908,21 +842,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -937,11 +870,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, elastic_san_name: str, **kwargs: Any) -> LROPoller[None]: @@ -952,14 +881,6 @@ def begin_delete(self, resource_group_name: str, elastic_san_name: str, **kwargs :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -986,7 +907,7 @@ def begin_delete(self, resource_group_name: str, elastic_san_name: str, **kwargs def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -997,17 +918,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, elastic_san_name: str, **kwargs: Any) -> _models.ElasticSan: @@ -1018,12 +935,11 @@ def get(self, resource_group_name: str, elastic_san_name: str, **kwargs: Any) -> :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ElasticSan or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.ElasticSan :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1037,21 +953,20 @@ def get(self, resource_group_name: str, elastic_san_name: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ElasticSan] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1064,10 +979,6 @@ def get(self, resource_group_name: str, elastic_san_name: str, **kwargs: Any) -> deserialized = self._deserialize("ElasticSan", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}" - } + return deserialized # type: ignore diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_operations.py index 5fa56ca8ae10..4589154ffacc 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +83,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Gets a list of ElasticSan operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elasticsan.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,7 +93,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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +104,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +122,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +138,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +154,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.ElasticSan/operations"} diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_private_endpoint_connections_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_private_endpoint_connections_operations.py index 2c376baede6a..790285581202 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_private_endpoint_connections_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_private_endpoint_connections_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,7 +54,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +104,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +151,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -189,7 +194,7 @@ def build_list_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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -247,10 +252,10 @@ def _create_initial( resource_group_name: str, elastic_san_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> _models.PrivateEndpointConnection: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -273,7 +278,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "PrivateEndpointConnection") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -282,16 +287,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -312,10 +316,6 @@ def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } - @overload def begin_create( self, @@ -341,14 +341,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.PrivateEndpointConnection] @@ -361,7 +353,7 @@ def begin_create( resource_group_name: str, elastic_san_name: str, private_endpoint_connection_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -376,18 +368,10 @@ def begin_create( :param private_endpoint_connection_name: The name of the Private Endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Private Endpoint Connection Approval object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.PrivateEndpointConnection] @@ -400,7 +384,7 @@ def begin_create( resource_group_name: str, elastic_san_name: str, private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO], + parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.PrivateEndpointConnection]: """Update the state of specified private endpoint connection associated with the Elastic San. @@ -413,19 +397,8 @@ def begin_create( :param private_endpoint_connection_name: The name of the Private Endpoint connection. Required. :type private_endpoint_connection_name: str :param parameters: Private Endpoint Connection Approval object. Is either a - PrivateEndpointConnection type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.PrivateEndpointConnection or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + PrivateEndpointConnection type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.elasticsan.models.PrivateEndpointConnection or IO[bytes] :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.PrivateEndpointConnection] @@ -458,7 +431,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -470,17 +443,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def get( @@ -495,12 +466,11 @@ def get( :type elastic_san_name: str :param private_endpoint_connection_name: The name of the Private Endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.PrivateEndpointConnection :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -514,22 +484,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,18 +511,14 @@ def get( deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return deserialized # type: ignore def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, elastic_san_name: str, private_endpoint_connection_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -567,22 +532,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, private_endpoint_connection_name=private_endpoint_connection_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -597,11 +561,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -616,14 +576,6 @@ def begin_delete( :type elastic_san_name: str :param private_endpoint_connection_name: The name of the Private Endpoint connection. Required. :type private_endpoint_connection_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -651,7 +603,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -662,17 +614,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections/{privateEndpointConnectionName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def list( @@ -685,7 +633,6 @@ def list( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either PrivateEndpointConnection or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elasticsan.models.PrivateEndpointConnection] @@ -697,7 +644,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 = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -708,17 +655,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -730,13 +676,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) @@ -746,11 +692,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -762,7 +708,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateEndpointConnections" - } diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_private_link_resources_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_private_link_resources_operations.py index f6cf2331754c..170baadf3f60 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_private_link_resources_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_private_link_resources_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_by_elastic_san_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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,12 +109,11 @@ def list_by_elastic_san( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateLinkResourceListResult or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.PrivateLinkResourceListResult :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -123,21 +127,20 @@ def list_by_elastic_san( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - request = build_list_by_elastic_san_request( + _request = build_list_by_elastic_san_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_elastic_san.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -150,10 +153,6 @@ def list_by_elastic_san( deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - list_by_elastic_san.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/privateLinkResources" - } + return deserialized # type: ignore diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_skus_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_skus_operations.py index 2c17b5a11e09..5df452e38328 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_skus_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_skus_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_list_request(subscription_id: str, *, filter: Optional[str] = None, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +95,6 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models :param filter: Specify $filter='location eq :code:``' to filter on location. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SkuInformation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elasticsan.models.SkuInformation] :raises ~azure.core.exceptions.HttpResponseError: @@ -101,7 +105,7 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SkuInformationList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -112,16 +116,15 @@ def list(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -133,13 +136,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SkuInformationList", pipeline_response) @@ -149,11 +152,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -165,5 +168,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.ElasticSan/skus"} diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volume_groups_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volume_groups_operations.py index bbe1ec449da1..1391dc28c70c 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volume_groups_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volume_groups_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,7 @@ def build_list_by_elastic_san_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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +90,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -136,7 +141,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -187,7 +192,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -235,7 +240,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -307,7 +312,6 @@ def list_by_elastic_san( :type resource_group_name: str :param elastic_san_name: The name of the ElasticSan. Required. :type elastic_san_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either VolumeGroup or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elasticsan.models.VolumeGroup] :raises ~azure.core.exceptions.HttpResponseError: @@ -318,7 +322,7 @@ def list_by_elastic_san( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VolumeGroupList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -329,17 +333,16 @@ def list_by_elastic_san( def prepare_request(next_link=None): if not next_link: - request = build_list_by_elastic_san_request( + _request = build_list_by_elastic_san_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_elastic_san.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -351,13 +354,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("VolumeGroupList", pipeline_response) @@ -367,11 +370,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -384,19 +387,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_elastic_san.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumeGroups" - } - def _create_initial( self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: Union[_models.VolumeGroup, IO], + parameters: Union[_models.VolumeGroup, IO[bytes]], **kwargs: Any ) -> _models.VolumeGroup: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -419,7 +418,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "VolumeGroup") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -428,16 +427,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -458,10 +456,6 @@ def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } - @overload def begin_create( self, @@ -487,14 +481,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -507,7 +493,7 @@ def begin_create( resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -522,18 +508,10 @@ def begin_create( :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str :param parameters: Volume Group object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -546,7 +524,7 @@ def begin_create( resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: Union[_models.VolumeGroup, IO], + parameters: Union[_models.VolumeGroup, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.VolumeGroup]: """Create a Volume Group. @@ -558,19 +536,9 @@ def begin_create( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :param parameters: Volume Group object. Is either a VolumeGroup type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.VolumeGroup or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Volume Group object. Is either a VolumeGroup type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.elasticsan.models.VolumeGroup or IO[bytes] :return: An instance of LROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -603,7 +571,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("VolumeGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -615,27 +583,25 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.VolumeGroup].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return LROPoller[_models.VolumeGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: Union[_models.VolumeGroupUpdate, IO], + parameters: Union[_models.VolumeGroupUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.VolumeGroup]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -658,7 +624,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "VolumeGroupUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -667,16 +633,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -695,13 +660,9 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -728,14 +689,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -748,7 +701,7 @@ def begin_update( resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -763,18 +716,10 @@ def begin_update( :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str :param parameters: Volume Group object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -787,7 +732,7 @@ def begin_update( resource_group_name: str, elastic_san_name: str, volume_group_name: str, - parameters: Union[_models.VolumeGroupUpdate, IO], + parameters: Union[_models.VolumeGroupUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.VolumeGroup]: """Update an VolumeGroup. @@ -799,20 +744,9 @@ def begin_update( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :param parameters: Volume Group object. Is either a VolumeGroupUpdate type or a IO type. + :param parameters: Volume Group object. Is either a VolumeGroupUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.VolumeGroupUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :type parameters: ~azure.mgmt.elasticsan.models.VolumeGroupUpdate or IO[bytes] :return: An instance of LROPoller that returns either VolumeGroup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.VolumeGroup] @@ -845,7 +779,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("VolumeGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -857,22 +791,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.VolumeGroup].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return LROPoller[_models.VolumeGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -886,22 +818,21 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -916,11 +847,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -935,14 +862,6 @@ def begin_delete( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -970,7 +889,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -981,17 +900,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -1006,12 +921,11 @@ def get( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: VolumeGroup or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.VolumeGroup :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1025,22 +939,21 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VolumeGroup] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1053,10 +966,6 @@ def get( deserialized = self._deserialize("VolumeGroup", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}" - } + return deserialized # type: ignore diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volume_snapshots_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volume_snapshots_operations.py index 274ce77c64c4..866ee2da0b20 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volume_snapshots_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volume_snapshots_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +56,7 @@ def build_list_by_volume_group_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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -106,7 +111,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -170,7 +175,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +236,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -322,7 +327,6 @@ def list_by_volume_group( :param filter: Specify $filter='volumeName eq :code:``' to filter on volume. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Snapshot or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elasticsan.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -333,7 +337,7 @@ def list_by_volume_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SnapshotList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -344,19 +348,18 @@ def list_by_volume_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_volume_group_request( + _request = build_list_by_volume_group_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, subscription_id=self._config.subscription_id, filter=filter, api_version=api_version, - template_url=self.list_by_volume_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -368,13 +371,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SnapshotList", pipeline_response) @@ -384,11 +387,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -401,20 +404,16 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_volume_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots" - } - def _create_initial( self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, snapshot_name: str, - parameters: Union[_models.Snapshot, IO], + parameters: Union[_models.Snapshot, IO[bytes]], **kwargs: Any ) -> _models.Snapshot: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -437,7 +436,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "Snapshot") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -447,16 +446,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -477,10 +475,6 @@ def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } - @overload def begin_create( self, @@ -509,14 +503,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -529,7 +515,7 @@ def begin_create( elastic_san_name: str, volume_group_name: str, snapshot_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -546,18 +532,10 @@ def begin_create( :param snapshot_name: The name of the volume snapshot within the given volume group. Required. :type snapshot_name: str :param parameters: Snapshot object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -570,7 +548,7 @@ def begin_create( elastic_san_name: str, volume_group_name: str, snapshot_name: str, - parameters: Union[_models.Snapshot, IO], + parameters: Union[_models.Snapshot, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Snapshot]: """Create a Volume Snapshot. @@ -584,19 +562,8 @@ def begin_create( :type volume_group_name: str :param snapshot_name: The name of the volume snapshot within the given volume group. Required. :type snapshot_name: str - :param parameters: Snapshot object. Is either a Snapshot type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.Snapshot or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Snapshot object. Is either a Snapshot type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.elasticsan.models.Snapshot or IO[bytes] :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Snapshot] :raises ~azure.core.exceptions.HttpResponseError: @@ -629,7 +596,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Snapshot", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -641,22 +608,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Snapshot].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } + return LROPoller[_models.Snapshot]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, elastic_san_name: str, volume_group_name: str, snapshot_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -670,23 +635,22 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -701,11 +665,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -722,14 +682,6 @@ def begin_delete( :type volume_group_name: str :param snapshot_name: The name of the volume snapshot within the given volume group. Required. :type snapshot_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -758,7 +710,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -769,17 +721,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -796,12 +744,11 @@ def get( :type volume_group_name: str :param snapshot_name: The name of the volume snapshot within the given volume group. Required. :type snapshot_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Snapshot or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.Snapshot :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -815,23 +762,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Snapshot] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, snapshot_name=snapshot_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -844,10 +790,6 @@ def get( deserialized = self._deserialize("Snapshot", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/snapshots/{snapshotName}" - } + return deserialized # type: ignore diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volumes_operations.py b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volumes_operations.py index 53b4813333d4..3d4fb8fb2ba2 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volumes_operations.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/azure/mgmt/elasticsan/operations/_volumes_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_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, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -109,7 +114,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -171,7 +176,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -231,7 +236,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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -282,7 +287,7 @@ def build_list_by_volume_group_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", "2023-01-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -349,10 +354,10 @@ def _create_initial( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: Union[_models.Volume, IO], + parameters: Union[_models.Volume, IO[bytes]], **kwargs: Any ) -> _models.Volume: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -375,7 +380,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "Volume") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -385,16 +390,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -415,10 +419,6 @@ def _create_initial( return deserialized # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } - @overload def begin_create( self, @@ -447,14 +447,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Volume] :raises ~azure.core.exceptions.HttpResponseError: @@ -467,7 +459,7 @@ def begin_create( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -484,18 +476,10 @@ def begin_create( :param volume_name: The name of the Volume. Required. :type volume_name: str :param parameters: Volume object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Volume] :raises ~azure.core.exceptions.HttpResponseError: @@ -508,7 +492,7 @@ def begin_create( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: Union[_models.Volume, IO], + parameters: Union[_models.Volume, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Volume]: """Create a Volume. @@ -522,19 +506,8 @@ def begin_create( :type volume_group_name: str :param volume_name: The name of the Volume. Required. :type volume_name: str - :param parameters: Volume object. Is either a Volume type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.Volume or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Volume object. Is either a Volume type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.elasticsan.models.Volume or IO[bytes] :return: An instance of LROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Volume] :raises ~azure.core.exceptions.HttpResponseError: @@ -567,7 +540,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Volume", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -579,17 +552,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Volume].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return LROPoller[_models.Volume]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _update_initial( self, @@ -597,10 +568,10 @@ def _update_initial( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: Union[_models.VolumeUpdate, IO], + parameters: Union[_models.VolumeUpdate, IO[bytes]], **kwargs: Any ) -> Optional[_models.Volume]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -623,7 +594,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "VolumeUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -633,16 +604,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -661,13 +631,9 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -697,14 +663,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Volume] :raises ~azure.core.exceptions.HttpResponseError: @@ -717,7 +675,7 @@ def begin_update( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -734,18 +692,10 @@ def begin_update( :param volume_name: The name of the Volume. Required. :type volume_name: str :param parameters: Volume object. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Volume] :raises ~azure.core.exceptions.HttpResponseError: @@ -758,7 +708,7 @@ def begin_update( elastic_san_name: str, volume_group_name: str, volume_name: str, - parameters: Union[_models.VolumeUpdate, IO], + parameters: Union[_models.VolumeUpdate, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.Volume]: """Update an Volume. @@ -772,19 +722,8 @@ def begin_update( :type volume_group_name: str :param volume_name: The name of the Volume. Required. :type volume_name: str - :param parameters: Volume object. Is either a VolumeUpdate type or a IO type. Required. - :type parameters: ~azure.mgmt.elasticsan.models.VolumeUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + :param parameters: Volume object. Is either a VolumeUpdate type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.elasticsan.models.VolumeUpdate or IO[bytes] :return: An instance of LROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.elasticsan.models.Volume] :raises ~azure.core.exceptions.HttpResponseError: @@ -817,7 +756,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("Volume", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -829,17 +768,15 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.Volume].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return LROPoller[_models.Volume]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, @@ -851,7 +788,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements x_ms_force_delete: Optional[Union[str, _models.XMsForceDelete]] = None, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -865,7 +802,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, @@ -874,16 +811,15 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements x_ms_delete_snapshots=x_ms_delete_snapshots, x_ms_force_delete=x_ms_force_delete, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -898,11 +834,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete( @@ -934,14 +866,6 @@ def begin_delete( value are only true or false. Default value is false. Known values are: "true" and "false". Default value is None. :type x_ms_force_delete: str or ~azure.mgmt.elasticsan.models.XMsForceDelete - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: @@ -972,7 +896,7 @@ def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( @@ -983,17 +907,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get( @@ -1010,12 +930,11 @@ def get( :type volume_group_name: str :param volume_name: The name of the Volume. Required. :type volume_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: Volume or the result of cls(response) :rtype: ~azure.mgmt.elasticsan.models.Volume :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1029,23 +948,22 @@ def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Volume] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, volume_name=volume_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1058,13 +976,9 @@ def get( deserialized = self._deserialize("Volume", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } + return deserialized # type: ignore @distributed_trace def list_by_volume_group( @@ -1079,7 +993,6 @@ def list_by_volume_group( :type elastic_san_name: str :param volume_group_name: The name of the VolumeGroup. Required. :type volume_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Volume or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.elasticsan.models.Volume] :raises ~azure.core.exceptions.HttpResponseError: @@ -1090,7 +1003,7 @@ def list_by_volume_group( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.VolumeList] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1101,18 +1014,17 @@ def list_by_volume_group( def prepare_request(next_link=None): if not next_link: - request = build_list_by_volume_group_request( + _request = build_list_by_volume_group_request( resource_group_name=resource_group_name, elastic_san_name=elastic_san_name, volume_group_name=volume_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_volume_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1124,13 +1036,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("VolumeList", pipeline_response) @@ -1140,11 +1052,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1156,7 +1068,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list_by_volume_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes" - } diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_create_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_create_maximum_set_gen.py index c82eeedbd37e..1a157f932926 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_create_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_create_maximum_set_gen.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -35,18 +38,18 @@ def main(): parameters={ "location": "France Central", "properties": { - "availabilityZones": ["1"], - "baseSizeTiB": 5, - "extendedCapacitySizeTiB": 25, + "availabilityZones": ["bgyobptiableh"], + "baseSizeTiB": 9, + "extendedCapacitySizeTiB": 6, "publicNetworkAccess": "Enabled", "sku": {"name": "Premium_LRS", "tier": "Premium"}, }, - "tags": {"key9316": "ihndtieqibtob"}, + "tags": {"key8999": "kzpsnqodjgfjyasktlxiboklydek"}, }, ).result() print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/ElasticSans_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_create_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_create_minimum_set_gen.py deleted file mode 100644 index 871ac1b310a5..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_create_minimum_set_gen.py +++ /dev/null @@ -1,45 +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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python elastic_sans_create_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.elastic_sans.begin_create( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - parameters={ - "location": "France Central", - "properties": {"baseSizeTiB": 15, "extendedCapacitySizeTiB": 27, "sku": {"name": "Premium_LRS"}}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Create_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_delete_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_delete_maximum_set_gen.py index ca40686e1482..b34f7790a1e6 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_delete_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -35,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/ElasticSans_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_delete_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_delete_minimum_set_gen.py deleted file mode 100644 index 1a3aa1e20535..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_delete_minimum_set_gen.py +++ /dev/null @@ -1,40 +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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python elastic_sans_delete_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - client.elastic_sans.begin_delete( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - ).result() - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_get_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_get_maximum_set_gen.py index 33d5b3601ffa..8069c396eef5 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_get_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/ElasticSans_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_get_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_get_minimum_set_gen.py deleted file mode 100644 index ec9d4d13f923..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_get_minimum_set_gen.py +++ /dev/null @@ -1,41 +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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python elastic_sans_get_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.elastic_sans.get( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - ) - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_resource_group_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_resource_group_maximum_set_gen.py index 300402c869ad..dd4bfa259712 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_resource_group_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_resource_group_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/ElasticSans_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_resource_group_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_resource_group_minimum_set_gen.py index 5c2d9c99d441..e6c94a4c78f3 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_resource_group_minimum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_resource_group_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/ElasticSans_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_subscription_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_subscription_maximum_set_gen.py index 0b6cebee9bd2..7ed08944d138 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_subscription_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_subscription_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/ElasticSans_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_subscription_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_subscription_minimum_set_gen.py index 0f38f9c7580e..a08195de4f76 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_subscription_minimum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_list_by_subscription_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/ElasticSans_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_update_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_update_maximum_set_gen.py index 7aa0697b3dee..126218f52a31 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_update_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/elastic_sans_update_maximum_set_gen.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -33,13 +36,13 @@ def main(): resource_group_name="resourcegroupname", elastic_san_name="elasticsanname", parameters={ - "properties": {"baseSizeTiB": 13, "extendedCapacitySizeTiB": 29, "publicNetworkAccess": "Enabled"}, - "tags": {"key1931": "yhjwkgmrrwrcoxblgwgzjqusch"}, + "properties": {"baseSizeTiB": 28, "extendedCapacitySizeTiB": 3, "publicNetworkAccess": "Enabled"}, + "tags": {"key6131": "pdmdonshncaahcffdtegnx"}, }, ).result() print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/ElasticSans_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/ElasticSans_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/operations_list_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/operations_list_maximum_set_gen.py index 4ff25ef71abf..8eb9d40822df 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/operations_list_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/operations_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Operations_List_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Operations_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/operations_list_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/operations_list_minimum_set_gen.py index dd171e31ec43..748d80c49e50 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/operations_list_minimum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/operations_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Operations_List_MinimumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Operations_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_create_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_create_maximum_set_gen.py index c8dbbe8d8756..d0056b726001 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_create_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_create_maximum_set_gen.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -35,11 +38,11 @@ def main(): private_endpoint_connection_name="privateendpointconnectionname", parameters={ "properties": { - "groupIds": ["jdwrzpemdjrpiwzvy"], + "groupIds": ["szjqerjjtbcxjxsaqlfcexperaoc"], "privateEndpoint": {}, "privateLinkServiceConnectionState": { - "actionsRequired": "jhjdpwvyzipggtn", - "description": "dxl", + "actionsRequired": "jnyswa", + "description": "iyhfjnligaieovq", "status": "Pending", }, } @@ -48,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/PrivateEndpointConnections_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_create_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_create_minimum_set_gen.py deleted file mode 100644 index 42f1941ce22a..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_create_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python private_endpoint_connections_create_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.private_endpoint_connections.begin_create( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - private_endpoint_connection_name="privateendpointconnectionname", - parameters={"properties": {"privateLinkServiceConnectionState": {}}}, - ).result() - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Create_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_delete_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_delete_maximum_set_gen.py index 27d41e6c54e8..d34ae2718520 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_delete_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/PrivateEndpointConnections_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_delete_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_delete_minimum_set_gen.py deleted file mode 100644 index 275767d0629f..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_delete_minimum_set_gen.py +++ /dev/null @@ -1,41 +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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python private_endpoint_connections_delete_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - client.private_endpoint_connections.begin_delete( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - private_endpoint_connection_name="privateendpointconnectionname", - ).result() - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_get_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_get_maximum_set_gen.py index e186b7e27e64..cbc30f9f82be 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_get_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/PrivateEndpointConnections_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_get_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_get_minimum_set_gen.py deleted file mode 100644 index 3dce6258a6ea..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_get_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python private_endpoint_connections_get_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.private_endpoint_connections.get( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - private_endpoint_connection_name="privateendpointconnectionname", - ) - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_list_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_list_maximum_set_gen.py index 8b48ff24577b..29b4a9cffa4e 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_list_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_List_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/PrivateEndpointConnections_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_list_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_list_minimum_set_gen.py deleted file mode 100644 index c029e6d263e9..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_endpoint_connections_list_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python private_endpoint_connections_list_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.private_endpoint_connections.list( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateEndpointConnections_List_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_link_resources_list_by_elastic_san_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_link_resources_list_by_elastic_san_maximum_set_gen.py index 9289d3a5733e..75cb7fb932b6 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_link_resources_list_by_elastic_san_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_link_resources_list_by_elastic_san_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateLinkResources_ListByElasticSan_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/PrivateLinkResources_ListByElasticSan_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_link_resources_list_by_elastic_san_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_link_resources_list_by_elastic_san_minimum_set_gen.py deleted file mode 100644 index 44dd080b2f30..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/private_link_resources_list_by_elastic_san_minimum_set_gen.py +++ /dev/null @@ -1,41 +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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python private_link_resources_list_by_elastic_san_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.private_link_resources.list_by_elastic_san( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - ) - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/PrivateLinkResources_ListByElasticSan_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/skus_list_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/skus_list_maximum_set_gen.py index 77a9cf9f0b58..d032e7a92a6b 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/skus_list_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/skus_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Skus_List_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Skus_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/skus_list_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/skus_list_minimum_set_gen.py index 386e2d607796..711cd1fbb8b6 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/skus_list_minimum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/skus_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Skus_List_MinimumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Skus_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_create_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_create_maximum_set_gen.py index e5763f5edbd9..aa520c638372 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_create_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_create_maximum_set_gen.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,25 +37,19 @@ def main(): elastic_san_name="elasticsanname", volume_group_name="volumegroupname", parameters={ - "identity": {"type": "None", "userAssignedIdentities": {"key7482": {}}}, + "identity": {"type": "None", "userAssignedIdentities": {"key6160": {}}}, "properties": { - "encryption": "EncryptionAtRestWithCustomerManagedKey", + "encryption": "EncryptionAtRestWithPlatformKey", "encryptionProperties": { - "identity": {"userAssignedIdentity": "im"}, + "identity": {"userAssignedIdentity": "xu"}, "keyVaultProperties": { - "keyName": "sftaiernmrzypnrkpakrrawxcbsqzc", - "keyVaultUri": "https://microsoft.com/axmblwp", - "keyVersion": "c", + "keyName": "oaamyfynvyzxlpdyadfiptxgex", + "keyVaultUri": "https://microsoft.com/a", + "keyVersion": "cwjwblxnmnhbbrdbxoopcsdghur", }, }, - "networkAcls": { - "virtualNetworkRules": [ - { - "action": "Allow", - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}", - } - ] - }, + "enforceDataIntegrityCheckForIscsi": True, + "networkAcls": {"virtualNetworkRules": [{"action": "Allow", "id": "dcywtkhbwqoaayzvj"}]}, "protocolType": "Iscsi", }, }, @@ -60,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeGroups_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_delete_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_delete_maximum_set_gen.py index 4242f602325e..cdc56fe84495 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_delete_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -36,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeGroups_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_delete_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_delete_minimum_set_gen.py deleted file mode 100644 index 738117e06f40..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_delete_minimum_set_gen.py +++ /dev/null @@ -1,41 +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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volume_groups_delete_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - client.volume_groups.begin_delete( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - ).result() - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_get_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_get_maximum_set_gen.py index 6f71dbf72588..9fb28756525d 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_get_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeGroups_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_get_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_get_minimum_set_gen.py deleted file mode 100644 index be792a84af47..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_get_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volume_groups_get_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.volume_groups.get( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - ) - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_list_by_elastic_san_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_list_by_elastic_san_maximum_set_gen.py index f772ccef2c45..8b03cef55626 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_list_by_elastic_san_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_list_by_elastic_san_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_ListByElasticSan_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeGroups_ListByElasticSan_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_list_by_elastic_san_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_list_by_elastic_san_minimum_set_gen.py deleted file mode 100644 index 6c8ac293834f..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_list_by_elastic_san_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volume_groups_list_by_elastic_san_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.volume_groups.list_by_elastic_san( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_ListByElasticSan_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_update_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_update_maximum_set_gen.py index 890d1952ed03..3d09c1989d6e 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_update_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_groups_update_maximum_set_gen.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,25 +37,19 @@ def main(): elastic_san_name="elasticsanname", volume_group_name="volumegroupname", parameters={ - "identity": {"type": "None", "userAssignedIdentities": {"key7482": {}}}, + "identity": {"type": "None", "userAssignedIdentities": {"key6160": {}}}, "properties": { "encryption": "EncryptionAtRestWithPlatformKey", "encryptionProperties": { - "identity": {"userAssignedIdentity": "im"}, + "identity": {"userAssignedIdentity": "xu"}, "keyVaultProperties": { - "keyName": "sftaiernmrzypnrkpakrrawxcbsqzc", - "keyVaultUri": "https://microsoft.com/axmblwp", - "keyVersion": "c", + "keyName": "oaamyfynvyzxlpdyadfiptxgex", + "keyVaultUri": "https://microsoft.com/a", + "keyVersion": "cwjwblxnmnhbbrdbxoopcsdghur", }, }, - "networkAcls": { - "virtualNetworkRules": [ - { - "action": "Allow", - "id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName}", - } - ] - }, + "enforceDataIntegrityCheckForIscsi": True, + "networkAcls": {"virtualNetworkRules": [{"action": "Allow", "id": "dcywtkhbwqoaayzvj"}]}, "protocolType": "Iscsi", }, }, @@ -60,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeGroups_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeGroups_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_create_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_create_maximum_set_gen.py index a4063914fb0e..286168640cda 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_create_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_create_maximum_set_gen.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,17 +37,11 @@ def main(): elastic_san_name="elasticsanname", volume_group_name="volumegroupname", snapshot_name="snapshotname", - parameters={ - "properties": { - "creationData": { - "sourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } - } - }, + parameters={"properties": {"creationData": {"sourceId": "o"}}}, ).result() print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeSnapshots_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_create_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_create_minimum_set_gen.py deleted file mode 100644 index 4b5543a963ce..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_create_minimum_set_gen.py +++ /dev/null @@ -1,50 +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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volume_snapshots_create_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.volume_snapshots.begin_create( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - snapshot_name="snapshotname", - parameters={ - "properties": { - "creationData": { - "sourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ElasticSan/elasticSans/{elasticSanName}/volumegroups/{volumeGroupName}/volumes/{volumeName}" - } - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Create_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_delete_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_delete_maximum_set_gen.py index 205e2feaede7..3c1e13dfed57 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_delete_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeSnapshots_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_delete_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_delete_minimum_set_gen.py deleted file mode 100644 index 80a18ee83b44..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_delete_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volume_snapshots_delete_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - client.volume_snapshots.begin_delete( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - snapshot_name="snapshotname", - ).result() - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_get_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_get_maximum_set_gen.py index 6caf772f0ff5..092d395c80b8 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_get_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeSnapshots_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_get_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_get_minimum_set_gen.py deleted file mode 100644 index 150ce46347bb..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_get_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volume_snapshots_get_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.volume_snapshots.get( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - snapshot_name="snapshotname", - ) - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_list_by_volume_group_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_list_by_volume_group_maximum_set_gen.py index e4014efd11f4..e4802021cae2 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_list_by_volume_group_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_list_by_volume_group_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_ListByVolumeGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/VolumeSnapshots_ListByVolumeGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_list_by_volume_group_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_list_by_volume_group_minimum_set_gen.py deleted file mode 100644 index 96abc463aac9..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volume_snapshots_list_by_volume_group_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volume_snapshots_list_by_volume_group_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.volume_snapshots.list_by_volume_group( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/VolumeSnapshots_ListByVolumeGroup_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_create_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_create_maximum_set_gen.py index 3aa5bf969a97..522e91d7ddde 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_create_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_create_maximum_set_gen.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -36,15 +39,15 @@ def main(): volume_name="volumename", parameters={ "properties": { - "creationData": {"createSource": "None", "sourceId": "ARM Id of Resource"}, - "managedBy": {"resourceId": "mtkeip"}, - "sizeGiB": 9, + "creationData": {"createSource": "None", "sourceId": "fkackofx"}, + "managedBy": {"resourceId": "fyodcxvtqlspavsxygxc"}, + "sizeGiB": 10, } }, ).result() print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Create_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Volumes_Create_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_create_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_create_minimum_set_gen.py deleted file mode 100644 index c46304ec6991..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_create_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volumes_create_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.volumes.begin_create( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - volume_name="volumename", - parameters={"properties": {"sizeGiB": 9}}, - ).result() - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Create_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_delete_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_delete_maximum_set_gen.py index f24374dae334..3ce765f657c5 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_delete_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -37,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Volumes_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_delete_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_delete_minimum_set_gen.py deleted file mode 100644 index c7031464292e..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_delete_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volumes_delete_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - client.volumes.begin_delete( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - volume_name="volumename", - ).result() - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Delete_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_get_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_get_maximum_set_gen.py index 4ecad17bfdcf..4c7a526186be 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_get_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Volumes_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_get_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_get_minimum_set_gen.py deleted file mode 100644 index 8ea341a3fb29..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_get_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volumes_get_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.volumes.get( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - volume_name="volumename", - ) - print(response) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Get_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_list_by_volume_group_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_list_by_volume_group_maximum_set_gen.py index 5aa804bbb093..827c6d549ee4 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_list_by_volume_group_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_list_by_volume_group_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -38,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_ListByVolumeGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Volumes_ListByVolumeGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_list_by_volume_group_minimum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_list_by_volume_group_minimum_set_gen.py deleted file mode 100644 index d9c194fcb167..000000000000 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_list_by_volume_group_minimum_set_gen.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.elasticsan import ElasticSanMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-elasticsan -# USAGE - python volumes_list_by_volume_group_minimum_set_gen.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 = ElasticSanMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subscriptionid", - ) - - response = client.volumes.list_by_volume_group( - resource_group_name="resourcegroupname", - elastic_san_name="elasticsanname", - volume_group_name="volumegroupname", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_ListByVolumeGroup_MinimumSet_Gen.json -if __name__ == "__main__": - main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_update_maximum_set_gen.py b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_update_maximum_set_gen.py index eaeba94bd11d..ca2fce0e1deb 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_update_maximum_set_gen.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/generated_samples/volumes_update_maximum_set_gen.py @@ -6,7 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import Any, IO, Union + from azure.identity import DefaultAzureCredential + from azure.mgmt.elasticsan import ElasticSanMgmtClient """ @@ -34,11 +37,11 @@ def main(): elastic_san_name="elasticsanname", volume_group_name="volumegroupname", volume_name="volumename", - parameters={"properties": {"sizeGiB": 11}}, + parameters={"properties": {"managedBy": {"resourceId": "fyodcxvtqlspavsxygxc"}, "sizeGiB": 30}}, ).result() print(response) -# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2023-01-01/examples/Volumes_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/elasticsan/resource-manager/Microsoft.ElasticSan/stable/2024-05-01/examples/Volumes_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/elasticsan/azure-mgmt-elasticsan/setup.py b/sdk/elasticsan/azure-mgmt-elasticsan/setup.py index 53d9f2817b68..fd9f46119fea 100644 --- a/sdk/elasticsan/azure-mgmt-elasticsan/setup.py +++ b/sdk/elasticsan/azure-mgmt-elasticsan/setup.py @@ -74,9 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], python_requires=">=3.8", )