From bdecb4308194068ceaff794c5adf147ec50b0bf1 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Wed, 4 Sep 2024 19:29:59 -0700 Subject: [PATCH] [AutoRelease] t2-qumulo-2024-07-11-04085(can only be merged by SDK owner) (#36433) * code and test * Update CHANGELOG.md * update-testcase * Update assets.json * disable recording test * update-testcase * Update CHANGELOG.md --------- Co-authored-by: azure-sdk Co-authored-by: Yuchao Yan Co-authored-by: ChenxiJiang333 --- sdk/qumulo/azure-mgmt-qumulo/CHANGELOG.md | 13 + sdk/qumulo/azure-mgmt-qumulo/README.md | 7 +- sdk/qumulo/azure-mgmt-qumulo/_meta.json | 10 +- .../azure/mgmt/qumulo/_configuration.py | 11 +- .../azure/mgmt/qumulo/_qumulo_mgmt_client.py | 31 +- .../azure/mgmt/qumulo/_serialization.py | 118 +++---- .../azure/mgmt/qumulo/_vendor.py | 30 -- .../azure/mgmt/qumulo/_version.py | 2 +- .../azure/mgmt/qumulo/aio/_configuration.py | 11 +- .../mgmt/qumulo/aio/_qumulo_mgmt_client.py | 33 +- .../operations/_file_systems_operations.py | 280 +++++++--------- .../mgmt/qumulo/aio/operations/_operations.py | 37 +-- .../azure/mgmt/qumulo/models/__init__.py | 2 - .../azure/mgmt/qumulo/models/_models_py3.py | 121 +++---- .../models/_qumulo_mgmt_client_enums.py | 13 +- .../operations/_file_systems_operations.py | 311 +++++++----------- .../mgmt/qumulo/operations/_operations.py | 39 +-- .../azure-mgmt-qumulo/dev_requirements.txt | 1 + ...ystems_create_or_update_maximum_set_gen.py | 40 +-- ...ystems_create_or_update_minimum_set_gen.py | 10 +- .../file_systems_delete_maximum_set_gen.py | 10 +- .../file_systems_delete_minimum_set_gen.py | 10 +- .../file_systems_get_maximum_set_gen.py | 7 +- .../file_systems_get_minimum_set_gen.py | 3 +- ..._list_by_resource_group_maximum_set_gen.py | 5 +- ..._list_by_resource_group_minimum_set_gen.py | 3 +- ...ms_list_by_subscription_maximum_set_gen.py | 5 +- ...ms_list_by_subscription_minimum_set_gen.py | 3 +- .../file_systems_update_maximum_set_gen.py | 28 +- .../operations_list_maximum_set_gen.py | 3 +- .../operations_list_minimum_set_gen.py | 3 +- .../generated_tests/conftest.py | 35 ++ ...est_qumulo_mgmt_file_systems_operations.py | 146 ++++++++ ...mulo_mgmt_file_systems_operations_async.py | 151 +++++++++ .../test_qumulo_mgmt_operations.py | 29 ++ .../test_qumulo_mgmt_operations_async.py | 30 ++ .../azure-mgmt-qumulo/sdk_packaging.toml | 2 +- sdk/qumulo/azure-mgmt-qumulo/setup.py | 86 ++--- .../azure-mgmt-qumulo/tests/conftest.py | 35 ++ ...mgmt_file_systems_operations_async_test.py | 29 ++ ...umulo_mgmt_file_systems_operations_test.py | 27 ++ .../test_qumulo_mgmt_operations_async_test.py | 26 ++ .../tests/test_qumulo_mgmt_operations_test.py | 25 ++ 43 files changed, 1120 insertions(+), 701 deletions(-) delete mode 100644 sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_vendor.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/generated_tests/conftest.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_file_systems_operations.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_file_systems_operations_async.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_operations.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_operations_async.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/tests/conftest.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_file_systems_operations_async_test.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_file_systems_operations_test.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_operations_async_test.py create mode 100644 sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_operations_test.py diff --git a/sdk/qumulo/azure-mgmt-qumulo/CHANGELOG.md b/sdk/qumulo/azure-mgmt-qumulo/CHANGELOG.md index 0fc8e7fbc3b..82e0fa06d6f 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/CHANGELOG.md +++ b/sdk/qumulo/azure-mgmt-qumulo/CHANGELOG.md @@ -1,5 +1,18 @@ # Release History +## 2.0.0 (2024-09-05) + +### Features Added + + - Model MarketplaceDetails has a new parameter term_unit + +### Breaking Changes + + - Model FileSystemResource no longer has parameter initial_capacity + - Rename parameter `private_i_ps` to `private_ips` in Model FileSystemResource + - Model FileSystemResourceUpdateProperties no longer has parameter cluster_login_url + - Model FileSystemResourceUpdateProperties no longer has parameter private_i_ps + ## 1.0.0 (2023-05-20) ### other change diff --git a/sdk/qumulo/azure-mgmt-qumulo/README.md b/sdk/qumulo/azure-mgmt-qumulo/README.md index d89b053b188..362c8c768c7 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/README.md +++ b/sdk/qumulo/azure-mgmt-qumulo/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Qumulo Management Client Library. -This package has been tested with Python 3.7+. +This package has been tested with Python 3.8+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -59,6 +59,3 @@ Code samples for this package can be found at: If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) section of the project. - - -![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-qumulo%2FREADME.png) diff --git a/sdk/qumulo/azure-mgmt-qumulo/_meta.json b/sdk/qumulo/azure-mgmt-qumulo/_meta.json index 86e68f59624..760aef2653d 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/_meta.json +++ b/sdk/qumulo/azure-mgmt-qumulo/_meta.json @@ -1,11 +1,11 @@ { - "commit": "38311a16b5bfcb756164c6c48a64b0bc90d01a54", + "commit": "224b9dc129f67fc484dfdcbf2853bfa35723b3a9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.2", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.4.8", - "@autorest/modelerfour@4.24.3" + "@autorest/python@6.15.0", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/liftrqumulo/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.4.8 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/liftrqumulo/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.15.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/liftrqumulo/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_configuration.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_configuration.py index d440d4125e2..a968d24c185 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_configuration.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_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 @@ if TYPE_CHECKING: from azure.core.credentials import TokenCredential -class QumuloMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class QumuloMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for QumuloMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class QumuloMgmtClientConfiguration(Configuration): # pylint: disable=too-many- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-12". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-06-19". 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(QumuloMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-10-12") + api_version: str = kwargs.pop("api_version", "2024-06-19") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ class QumuloMgmtClientConfiguration(Configuration): # pylint: disable=too-many- self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-qumulo/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ class QumuloMgmtClientConfiguration(Configuration): # pylint: disable=too-many- 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/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_qumulo_mgmt_client.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_qumulo_mgmt_client.py index ea1b7e42e06..f5fcdb8b7a4 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_qumulo_mgmt_client.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_qumulo_mgmt_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from typing_extensions import Self +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 QumuloMgmtClientConfiguration @@ -35,7 +38,7 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-12". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-06-19". 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 @@ -50,7 +53,25 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword **kwargs: Any ) -> None: self._config = QumuloMgmtClientConfiguration(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) @@ -59,7 +80,7 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.file_systems = FileSystemsOperations(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 @@ -79,12 +100,12 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword 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() - def __enter__(self) -> "QumuloMgmtClient": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_serialization.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_serialization.py index 842ae727fbb..8139854b97b 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_serialization.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_serialization.py @@ -63,8 +63,8 @@ import xml.etree.ElementTree as ET 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 @@ class RawDeserializer: 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,9 @@ class RawDeserializer: # 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 + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +172,6 @@ class RawDeserializer: 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 +290,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 +335,7 @@ class Model(object): 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 +346,7 @@ class Model(object): :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 +385,7 @@ class Model(object): :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 +410,7 @@ class Model(object): :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 +440,7 @@ class Model(object): 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 +540,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 +556,7 @@ class Serializer(object): "[]": 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 +644,7 @@ class Serializer(object): 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 @@ -662,12 +657,13 @@ class Serializer(object): _serialized.update(_new_attr) # type: ignore _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] - except ValueError: - continue + except ValueError as err: + if isinstance(err, SerializationError): + raise 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 @@ -709,7 +705,7 @@ class Serializer(object): ] 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) @@ -729,6 +725,7 @@ class Serializer(object): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -741,7 +738,9 @@ class Serializer(object): :param data: The data to be serialized. :param str data_type: The type to be serialized from. - :rtype: str + :keyword bool skip_quote: Whether to skip quote the serialized result. + Defaults to False. + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -749,10 +748,8 @@ class Serializer(object): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - data = [self.serialize_data(d, internal_data_type, **kwargs) if d is not None else "" for d in data] - if not kwargs.get("skip_quote", False): - data = [quote(str(d), safe="") for d in data] - return str(self.serialize_iter(data, internal_data_type, **kwargs)) + do_quote = not kwargs.get("skip_quote", False) + 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) @@ -803,7 +800,7 @@ class Serializer(object): 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) @@ -823,7 +820,7 @@ class Serializer(object): 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) @@ -891,6 +888,8 @@ class Serializer(object): not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. + :keyword bool do_quote: Whether to quote the serialized result of each iterable element. + Defaults to False. :rtype: list, str """ if isinstance(data, str): @@ -903,9 +902,14 @@ class Serializer(object): for d in data: try: serialized.append(self.serialize_data(d, iter_type, **kwargs)) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized.append(None) + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] + if div: serialized = ["" if s is None else str(s) for s in serialized] serialized = div.join(serialized) @@ -950,7 +954,9 @@ class Serializer(object): for key, value in attr.items(): try: serialized[self.serialize_unicode(key)] = self.serialize_data(value, dict_type, **kwargs) - except ValueError: + except ValueError as err: + if isinstance(err, SerializationError): + raise serialized[self.serialize_unicode(key)] = None if "xml" in serialization_ctxt: @@ -983,7 +989,7 @@ class Serializer(object): 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) @@ -1160,10 +1166,10 @@ class Serializer(object): 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): @@ -1199,7 +1205,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:]) @@ -1220,7 +1225,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:]) @@ -1361,7 +1365,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, @@ -1381,7 +1385,7 @@ class Deserializer(object): "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 @@ -1434,12 +1438,12 @@ class Deserializer(object): 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) - if data is None: + if data is None or data is CoreNull: return data try: attributes = response._attribute_map # type: ignore @@ -1471,7 +1475,7 @@ class Deserializer(object): 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) @@ -1505,14 +1509,14 @@ class Deserializer(object): 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 @@ -1568,7 +1572,7 @@ class Deserializer(object): 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 @@ -1642,7 +1646,7 @@ class Deserializer(object): 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) @@ -1690,7 +1694,7 @@ class Deserializer(object): 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: @@ -1747,7 +1751,7 @@ class Deserializer(object): 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"]: @@ -1798,7 +1802,6 @@ class Deserializer(object): 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: @@ -1852,10 +1855,10 @@ class Deserializer(object): 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): @@ -1883,7 +1886,7 @@ class Deserializer(object): 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 @@ -1900,7 +1903,7 @@ class Deserializer(object): 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): @@ -1935,7 +1938,7 @@ class Deserializer(object): 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 @@ -1972,7 +1975,7 @@ class Deserializer(object): 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 @@ -1988,9 +1991,10 @@ class Deserializer(object): 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/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_vendor.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_vendor.py deleted file mode 100644 index bd0df84f531..00000000000 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_vendor.py +++ /dev/null @@ -1,30 +0,0 @@ -# -------------------------------------------------------------------------- -# 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 typing import List, cast - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request - - -def _format_url_section(template, **kwargs): - components = template.split("/") - while components: - try: - return template.format(**kwargs) - except KeyError as key: - # Need the cast, as for some reasons "split" is typed as list[str | Any] - formatted_components = cast(List[str], template.split("/")) - components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] - template = "/".join(components) diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_version.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_version.py index c47f66669f1..48944bf3938 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_version.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/_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 = "2.0.0" diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/_configuration.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/_configuration.py index d126882915b..3c87b141936 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/_configuration.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/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 @@ if TYPE_CHECKING: from azure.core.credentials_async import AsyncTokenCredential -class QumuloMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class QumuloMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for QumuloMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,13 @@ class QumuloMgmtClientConfiguration(Configuration): # pylint: disable=too-many- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-10-12". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-06-19". 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(QumuloMgmtClientConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-10-12") + api_version: str = kwargs.pop("api_version", "2024-06-19") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ class QumuloMgmtClientConfiguration(Configuration): # pylint: disable=too-many- self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-qumulo/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ class QumuloMgmtClientConfiguration(Configuration): # pylint: disable=too-many- 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/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/_qumulo_mgmt_client.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/_qumulo_mgmt_client.py index 7f910a59c00..a09a23c6f91 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/_qumulo_mgmt_client.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/_qumulo_mgmt_client.py @@ -8,9 +8,12 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from typing_extensions import Self +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 @@ -35,7 +38,7 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-10-12". Note that overriding this + :keyword api_version: Api Version. Default value is "2024-06-19". 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 @@ -50,7 +53,25 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword **kwargs: Any ) -> None: self._config = QumuloMgmtClientConfiguration(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) @@ -59,7 +80,9 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.file_systems = FileSystemsOperations(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 @@ -79,12 +102,12 @@ class QumuloMgmtClient: # pylint: disable=client-accepts-api-version-keyword 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() - async def __aenter__(self) -> "QumuloMgmtClient": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/operations/_file_systems_operations.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/operations/_file_systems_operations.py index aff6f923d03..4804d9fe1fc 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/operations/_file_systems_operations.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/operations/_file_systems_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,9 @@ # 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, IO, Optional, TypeVar, Union, cast, overload +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -19,9 +21,8 @@ from azure.core.exceptions import ( map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict @@ -29,7 +30,6 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request from ...operations._file_systems_operations import ( build_create_or_update_request, build_delete_request, @@ -39,6 +39,10 @@ from ...operations._file_systems_operations import ( 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]] @@ -66,7 +70,6 @@ class FileSystemsOperations: def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.FileSystemResource"]: """List FileSystemResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileSystemResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.qumulo.models.FileSystemResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -77,7 +80,7 @@ class FileSystemsOperations: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileSystemResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,15 +91,13 @@ class FileSystemsOperations: 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.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -108,13 +109,12 @@ class FileSystemsOperations: } ) _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FileSystemResourceListResult", pipeline_response) @@ -124,11 +124,11 @@ class FileSystemsOperations: 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 @@ -141,8 +141,6 @@ class FileSystemsOperations: return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Qumulo.Storage/fileSystems"} - @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any @@ -152,7 +150,6 @@ class FileSystemsOperations: :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 FileSystemResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.qumulo.models.FileSystemResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -163,7 +160,7 @@ class FileSystemsOperations: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileSystemResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -174,16 +171,14 @@ class FileSystemsOperations: 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.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -195,13 +190,12 @@ class FileSystemsOperations: } ) _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FileSystemResourceListResult", pipeline_response) @@ -211,11 +205,11 @@ class FileSystemsOperations: 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 @@ -228,10 +222,6 @@ class FileSystemsOperations: return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems" - } - @distributed_trace_async async def get(self, resource_group_name: str, file_system_name: str, **kwargs: Any) -> _models.FileSystemResource: """Get a FileSystemResource. @@ -241,12 +231,11 @@ class FileSystemsOperations: :type resource_group_name: str :param file_system_name: Name of the File System resource. Required. :type file_system_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileSystemResource or the result of cls(response) :rtype: ~azure.mgmt.qumulo.models.FileSystemResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -260,21 +249,19 @@ class FileSystemsOperations: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileSystemResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, file_system_name=file_system_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.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 @@ -284,25 +271,21 @@ class FileSystemsOperations: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileSystemResource", pipeline_response) + deserialized = self._deserialize("FileSystemResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } + return deserialized # type: ignore async def _create_or_update_initial( self, resource_group_name: str, file_system_name: str, - resource: Union[_models.FileSystemResource, IO], + resource: Union[_models.FileSystemResource, IO[bytes]], **kwargs: Any - ) -> _models.FileSystemResource: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -315,17 +298,17 @@ class FileSystemsOperations: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FileSystemResource] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(resource, (IO, bytes)): + if isinstance(resource, (IOBase, bytes)): _content = resource else: _json = self._serialize.body(resource, "FileSystemResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, file_system_name=file_system_name, subscription_id=self._config.subscription_id, @@ -333,40 +316,41 @@ class FileSystemsOperations: content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _stream = True 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 if response.status_code not in [200, 201]: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("FileSystemResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 201: - deserialized = self._deserialize("FileSystemResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } - @overload async def begin_create_or_update( self, @@ -389,14 +373,6 @@ class FileSystemsOperations: :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 FileSystemResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.qumulo.models.FileSystemResource] @@ -408,7 +384,7 @@ class FileSystemsOperations: self, resource_group_name: str, file_system_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -421,18 +397,10 @@ class FileSystemsOperations: :param file_system_name: Name of the File System resource. Required. :type file_system_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: 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 FileSystemResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.qumulo.models.FileSystemResource] @@ -444,7 +412,7 @@ class FileSystemsOperations: self, resource_group_name: str, file_system_name: str, - resource: Union[_models.FileSystemResource, IO], + resource: Union[_models.FileSystemResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.FileSystemResource]: """Create a FileSystemResource. @@ -454,20 +422,9 @@ class FileSystemsOperations: :type resource_group_name: str :param file_system_name: Name of the File System resource. Required. :type file_system_name: str - :param resource: Resource create parameters. Is either a FileSystemResource type or a IO type. - Required. - :type resource: ~azure.mgmt.qumulo.models.FileSystemResource 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 resource: Resource create parameters. Is either a FileSystemResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.qumulo.models.FileSystemResource or IO[bytes] :return: An instance of AsyncLROPoller that returns either FileSystemResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.qumulo.models.FileSystemResource] @@ -494,12 +451,13 @@ class FileSystemsOperations: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FileSystemResource", pipeline_response) + deserialized = self._deserialize("FileSystemResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -512,17 +470,15 @@ class FileSystemsOperations: else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.FileSystemResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } + return AsyncLROPoller[_models.FileSystemResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload async def update( @@ -546,7 +502,6 @@ class FileSystemsOperations: :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileSystemResource or the result of cls(response) :rtype: ~azure.mgmt.qumulo.models.FileSystemResource :raises ~azure.core.exceptions.HttpResponseError: @@ -557,7 +512,7 @@ class FileSystemsOperations: self, resource_group_name: str, file_system_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -570,11 +525,10 @@ class FileSystemsOperations: :param file_system_name: Name of the File System resource. Required. :type file_system_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileSystemResource or the result of cls(response) :rtype: ~azure.mgmt.qumulo.models.FileSystemResource :raises ~azure.core.exceptions.HttpResponseError: @@ -585,7 +539,7 @@ class FileSystemsOperations: self, resource_group_name: str, file_system_name: str, - properties: Union[_models.FileSystemResourceUpdate, IO], + properties: Union[_models.FileSystemResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.FileSystemResource: """Update a FileSystemResource. @@ -596,17 +550,13 @@ class FileSystemsOperations: :param file_system_name: Name of the File System resource. Required. :type file_system_name: str :param properties: The resource properties to be updated. Is either a FileSystemResourceUpdate - type or a IO type. Required. - :type properties: ~azure.mgmt.qumulo.models.FileSystemResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.qumulo.models.FileSystemResourceUpdate or IO[bytes] :return: FileSystemResource or the result of cls(response) :rtype: ~azure.mgmt.qumulo.models.FileSystemResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -624,12 +574,12 @@ class FileSystemsOperations: content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IO, bytes)): + if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "FileSystemResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, file_system_name=file_system_name, subscription_id=self._config.subscription_id, @@ -637,16 +587,14 @@ class FileSystemsOperations: content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 @@ -656,21 +604,17 @@ class FileSystemsOperations: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileSystemResource", pipeline_response) + deserialized = self._deserialize("FileSystemResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } - - async def _delete_initial( # pylint: disable=inconsistent-return-statements + async def _delete_initial( self, resource_group_name: str, file_system_name: str, **kwargs: Any - ) -> None: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -682,38 +626,48 @@ class FileSystemsOperations: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, file_system_name=file_system_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.url = self._client.format_url(_request.url) - _stream = False + _stream = True 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 - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: + await response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } + deserialized = response.stream_download(self._client._pipeline) + + if response.status_code == 204: + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace_async async def begin_delete( @@ -726,14 +680,6 @@ class FileSystemsOperations: :type resource_group_name: str :param file_system_name: Name of the File System resource. Required. :type file_system_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: @@ -747,7 +693,7 @@ class FileSystemsOperations: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._delete_initial( # type: ignore + raw_result = await self._delete_initial( resource_group_name=resource_group_name, file_system_name=file_system_name, api_version=api_version, @@ -756,30 +702,26 @@ class FileSystemsOperations: params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: - return AsyncLROPoller.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/Qumulo.Storage/fileSystems/{fileSystemName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/operations/_operations.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/operations/_operations.py index fa3e47e862a..00377999c17 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/aio/operations/_operations.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/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 @@ -19,16 +20,18 @@ from azure.core.exceptions import ( map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models -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 +59,6 @@ class Operations: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.qumulo.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -67,7 +69,7 @@ class Operations: 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 +80,12 @@ class Operations: 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.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +97,12 @@ class Operations: } ) _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.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 +112,11 @@ class Operations: return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +128,3 @@ class Operations: return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Qumulo.Storage/operations"} diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/__init__.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/__init__.py index 209348b21e8..17dd67a5cd5 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/__init__.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/__init__.py @@ -30,7 +30,6 @@ from ._qumulo_mgmt_client_enums import ManagedServiceIdentityType from ._qumulo_mgmt_client_enums import MarketplaceSubscriptionStatus from ._qumulo_mgmt_client_enums import Origin from ._qumulo_mgmt_client_enums import ProvisioningState -from ._qumulo_mgmt_client_enums import StorageSku from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk @@ -59,7 +58,6 @@ __all__ = [ "MarketplaceSubscriptionStatus", "Origin", "ProvisioningState", - "StorageSku", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/_models_py3.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/_models_py3.py index a8828f34f81..8dd1431148d 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/_models_py3.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/_models_py3.py @@ -115,7 +115,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 @@ -156,10 +156,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 @@ -205,14 +205,15 @@ class TrackedResource(Resource): class FileSystemResource(TrackedResource): # pylint: disable=too-many-instance-attributes - """A FileSystem Resource by Qumulo. + """Concrete tracked resource types can be created by aliasing this type using a specific property + type. 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 @@ -228,26 +229,23 @@ class FileSystemResource(TrackedResource): # pylint: disable=too-many-instance- :vartype location: str :ivar identity: The managed service identities assigned to this resource. :vartype identity: ~azure.mgmt.qumulo.models.ManagedServiceIdentity - :ivar marketplace_details: Marketplace details. Required. + :ivar marketplace_details: Marketplace details. :vartype marketplace_details: ~azure.mgmt.qumulo.models.MarketplaceDetails :ivar provisioning_state: Provisioning State of the resource. Known values are: "Accepted", - "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", "Deleted", and - "NotSpecified". + "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Canceled", and "Deleted". :vartype provisioning_state: str or ~azure.mgmt.qumulo.models.ProvisioningState - :ivar storage_sku: Storage Sku. Required. Known values are: "Standard" and "Performance". - :vartype storage_sku: str or ~azure.mgmt.qumulo.models.StorageSku - :ivar user_details: User Details. Required. + :ivar storage_sku: Storage Sku. + :vartype storage_sku: str + :ivar user_details: User Details. :vartype user_details: ~azure.mgmt.qumulo.models.UserDetails - :ivar delegated_subnet_id: Delegated subnet id for Vnet injection. Required. + :ivar delegated_subnet_id: Delegated subnet id for Vnet injection. :vartype delegated_subnet_id: str :ivar cluster_login_url: File system Id of the resource. :vartype cluster_login_url: str - :ivar private_i_ps: Private IPs of the resource. - :vartype private_i_ps: list[str] - :ivar admin_password: Initial administrator password of the resource. Required. + :ivar private_ips: Private IPs of the resource. + :vartype private_ips: list[str] + :ivar admin_password: Initial administrator password of the resource. :vartype admin_password: str - :ivar initial_capacity: Storage capacity in TB. Required. - :vartype initial_capacity: int :ivar availability_zone: Availability zone. :vartype availability_zone: str """ @@ -258,13 +256,7 @@ class FileSystemResource(TrackedResource): # pylint: disable=too-many-instance- "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, - "marketplace_details": {"required": True}, "provisioning_state": {"readonly": True}, - "storage_sku": {"required": True}, - "user_details": {"required": True}, - "delegated_subnet_id": {"required": True}, - "admin_password": {"required": True}, - "initial_capacity": {"required": True}, } _attribute_map = { @@ -281,9 +273,8 @@ class FileSystemResource(TrackedResource): # pylint: disable=too-many-instance- "user_details": {"key": "properties.userDetails", "type": "UserDetails"}, "delegated_subnet_id": {"key": "properties.delegatedSubnetId", "type": "str"}, "cluster_login_url": {"key": "properties.clusterLoginUrl", "type": "str"}, - "private_i_ps": {"key": "properties.privateIPs", "type": "[str]"}, + "private_ips": {"key": "properties.privateIPs", "type": "[str]"}, "admin_password": {"key": "properties.adminPassword", "type": "str"}, - "initial_capacity": {"key": "properties.initialCapacity", "type": "int"}, "availability_zone": {"key": "properties.availabilityZone", "type": "str"}, } @@ -291,16 +282,15 @@ class FileSystemResource(TrackedResource): # pylint: disable=too-many-instance- self, *, location: str, - marketplace_details: "_models.MarketplaceDetails", - storage_sku: Union[str, "_models.StorageSku"], - user_details: "_models.UserDetails", - delegated_subnet_id: str, - admin_password: str, - initial_capacity: int, tags: Optional[Dict[str, str]] = None, identity: Optional["_models.ManagedServiceIdentity"] = None, + marketplace_details: Optional["_models.MarketplaceDetails"] = None, + storage_sku: Optional[str] = None, + user_details: Optional["_models.UserDetails"] = None, + delegated_subnet_id: Optional[str] = None, cluster_login_url: Optional[str] = None, - private_i_ps: Optional[List[str]] = None, + private_ips: Optional[List[str]] = None, + admin_password: Optional[str] = None, availability_zone: Optional[str] = None, **kwargs: Any ) -> None: @@ -311,22 +301,20 @@ class FileSystemResource(TrackedResource): # pylint: disable=too-many-instance- :paramtype location: str :keyword identity: The managed service identities assigned to this resource. :paramtype identity: ~azure.mgmt.qumulo.models.ManagedServiceIdentity - :keyword marketplace_details: Marketplace details. Required. + :keyword marketplace_details: Marketplace details. :paramtype marketplace_details: ~azure.mgmt.qumulo.models.MarketplaceDetails - :keyword storage_sku: Storage Sku. Required. Known values are: "Standard" and "Performance". - :paramtype storage_sku: str or ~azure.mgmt.qumulo.models.StorageSku - :keyword user_details: User Details. Required. + :keyword storage_sku: Storage Sku. + :paramtype storage_sku: str + :keyword user_details: User Details. :paramtype user_details: ~azure.mgmt.qumulo.models.UserDetails - :keyword delegated_subnet_id: Delegated subnet id for Vnet injection. Required. + :keyword delegated_subnet_id: Delegated subnet id for Vnet injection. :paramtype delegated_subnet_id: str :keyword cluster_login_url: File system Id of the resource. :paramtype cluster_login_url: str - :keyword private_i_ps: Private IPs of the resource. - :paramtype private_i_ps: list[str] - :keyword admin_password: Initial administrator password of the resource. Required. + :keyword private_ips: Private IPs of the resource. + :paramtype private_ips: list[str] + :keyword admin_password: Initial administrator password of the resource. :paramtype admin_password: str - :keyword initial_capacity: Storage capacity in TB. Required. - :paramtype initial_capacity: int :keyword availability_zone: Availability zone. :paramtype availability_zone: str """ @@ -338,16 +326,15 @@ class FileSystemResource(TrackedResource): # pylint: disable=too-many-instance- self.user_details = user_details self.delegated_subnet_id = delegated_subnet_id self.cluster_login_url = cluster_login_url - self.private_i_ps = private_i_ps + self.private_ips = private_ips self.admin_password = admin_password - self.initial_capacity = initial_capacity self.availability_zone = availability_zone class FileSystemResourceListResult(_serialization.Model): """The response of a FileSystemResource list operation. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar value: The FileSystemResource items on this page. Required. :vartype value: list[~azure.mgmt.qumulo.models.FileSystemResource] @@ -426,18 +413,12 @@ class FileSystemResourceUpdateProperties(_serialization.Model): :vartype user_details: ~azure.mgmt.qumulo.models.UserDetails :ivar delegated_subnet_id: Delegated subnet id for Vnet injection. :vartype delegated_subnet_id: str - :ivar cluster_login_url: File system Id of the resource. - :vartype cluster_login_url: str - :ivar private_i_ps: Private IPs of the resource. - :vartype private_i_ps: list[str] """ _attribute_map = { "marketplace_details": {"key": "marketplaceDetails", "type": "MarketplaceDetails"}, "user_details": {"key": "userDetails", "type": "UserDetails"}, "delegated_subnet_id": {"key": "delegatedSubnetId", "type": "str"}, - "cluster_login_url": {"key": "clusterLoginUrl", "type": "str"}, - "private_i_ps": {"key": "privateIPs", "type": "[str]"}, } def __init__( @@ -446,8 +427,6 @@ class FileSystemResourceUpdateProperties(_serialization.Model): marketplace_details: Optional["_models.MarketplaceDetails"] = None, user_details: Optional["_models.UserDetails"] = None, delegated_subnet_id: Optional[str] = None, - cluster_login_url: Optional[str] = None, - private_i_ps: Optional[List[str]] = None, **kwargs: Any ) -> None: """ @@ -457,17 +436,11 @@ class FileSystemResourceUpdateProperties(_serialization.Model): :paramtype user_details: ~azure.mgmt.qumulo.models.UserDetails :keyword delegated_subnet_id: Delegated subnet id for Vnet injection. :paramtype delegated_subnet_id: str - :keyword cluster_login_url: File system Id of the resource. - :paramtype cluster_login_url: str - :keyword private_i_ps: Private IPs of the resource. - :paramtype private_i_ps: list[str] """ super().__init__(**kwargs) self.marketplace_details = marketplace_details self.user_details = user_details self.delegated_subnet_id = delegated_subnet_id - self.cluster_login_url = cluster_login_url - self.private_i_ps = private_i_ps class ManagedServiceIdentity(_serialization.Model): @@ -475,7 +448,7 @@ class ManagedServiceIdentity(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar principal_id: The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. @@ -485,11 +458,11 @@ class ManagedServiceIdentity(_serialization.Model): :vartype tenant_id: str :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". + "SystemAssigned,UserAssigned". :vartype type: str or ~azure.mgmt.qumulo.models.ManagedServiceIdentityType :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :vartype user_assigned_identities: dict[str, ~azure.mgmt.qumulo.models.UserAssignedIdentity] """ @@ -517,11 +490,11 @@ class ManagedServiceIdentity(_serialization.Model): """ :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". + "SystemAssigned,UserAssigned". :paramtype type: str or ~azure.mgmt.qumulo.models.ManagedServiceIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.qumulo.models.UserAssignedIdentity] """ @@ -537,7 +510,7 @@ class MarketplaceDetails(_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 marketplace_subscription_id: Marketplace Subscription Id. :vartype marketplace_subscription_id: str @@ -545,8 +518,10 @@ class MarketplaceDetails(_serialization.Model): :vartype plan_id: str :ivar offer_id: Offer Id. Required. :vartype offer_id: str - :ivar publisher_id: Publisher Id. Required. + :ivar publisher_id: Publisher Id. :vartype publisher_id: str + :ivar term_unit: Term Unit. + :vartype term_unit: str :ivar marketplace_subscription_status: Marketplace subscription status. Known values are: "PendingFulfillmentStart", "Subscribed", "Suspended", and "Unsubscribed". :vartype marketplace_subscription_status: str or @@ -556,7 +531,6 @@ class MarketplaceDetails(_serialization.Model): _validation = { "plan_id": {"required": True}, "offer_id": {"required": True}, - "publisher_id": {"required": True}, "marketplace_subscription_status": {"readonly": True}, } @@ -565,6 +539,7 @@ class MarketplaceDetails(_serialization.Model): "plan_id": {"key": "planId", "type": "str"}, "offer_id": {"key": "offerId", "type": "str"}, "publisher_id": {"key": "publisherId", "type": "str"}, + "term_unit": {"key": "termUnit", "type": "str"}, "marketplace_subscription_status": {"key": "marketplaceSubscriptionStatus", "type": "str"}, } @@ -573,8 +548,9 @@ class MarketplaceDetails(_serialization.Model): *, plan_id: str, offer_id: str, - publisher_id: str, marketplace_subscription_id: Optional[str] = None, + publisher_id: Optional[str] = None, + term_unit: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -584,14 +560,17 @@ class MarketplaceDetails(_serialization.Model): :paramtype plan_id: str :keyword offer_id: Offer Id. Required. :paramtype offer_id: str - :keyword publisher_id: Publisher Id. Required. + :keyword publisher_id: Publisher Id. :paramtype publisher_id: str + :keyword term_unit: Term Unit. + :paramtype term_unit: str """ super().__init__(**kwargs) self.marketplace_subscription_id = marketplace_subscription_id self.plan_id = plan_id self.offer_id = offer_id self.publisher_id = publisher_id + self.term_unit = term_unit self.marketplace_subscription_status = None @@ -811,7 +790,7 @@ class UserAssignedIdentity(_serialization.Model): class UserDetails(_serialization.Model): """User Details of Qumulo FileSystem resource. - 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 email: User Email. Required. :vartype email: str diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/_qumulo_mgmt_client_enums.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/_qumulo_mgmt_client_enums.py index e90fa8fa4c1..335366688d4 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/_qumulo_mgmt_client_enums.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/models/_qumulo_mgmt_client_enums.py @@ -33,7 +33,7 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" SYSTEM_ASSIGNED = "SystemAssigned" USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" class MarketplaceSubscriptionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -78,14 +78,3 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """File system resource creation canceled""" DELETED = "Deleted" """File system resource is deleted""" - NOT_SPECIFIED = "NotSpecified" - """File system resource state is unknown""" - - -class StorageSku(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Storage Sku.""" - - STANDARD = "Standard" - """Standard Storage Sku""" - PERFORMANCE = "Performance" - """Performance Storage Sku""" diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/operations/_file_systems_operations.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/operations/_file_systems_operations.py index d0f5e55b09b..3e83ebabf5c 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/operations/_file_systems_operations.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/operations/_file_systems_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,9 @@ # 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, IO, Iterable, Optional, TypeVar, Union, cast, overload +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -19,9 +21,8 @@ from azure.core.exceptions import ( ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -29,8 +30,11 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section +if sys.version_info >= (3, 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]] @@ -42,7 +46,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", "2022-10-12")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +55,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -66,7 +70,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", "2022-10-12")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +85,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ ), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -98,7 +102,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", "2022-10-12")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,10 +115,10 @@ def build_get_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "fileSystemName": _SERIALIZER.url("file_system_name", file_system_name, "str"), + "fileSystemName": _SERIALIZER.url("file_system_name", file_system_name, "str", pattern=r"^[a-zA-Z0-9_-]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,7 +135,7 @@ def build_create_or_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", "2022-10-12")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-19")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -145,10 +149,10 @@ def build_create_or_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "fileSystemName": _SERIALIZER.url("file_system_name", file_system_name, "str"), + "fileSystemName": _SERIALIZER.url("file_system_name", file_system_name, "str", pattern=r"^[a-zA-Z0-9_-]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,7 +171,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", "2022-10-12")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-19")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -181,10 +185,10 @@ def build_update_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "fileSystemName": _SERIALIZER.url("file_system_name", file_system_name, "str"), + "fileSystemName": _SERIALIZER.url("file_system_name", file_system_name, "str", pattern=r"^[a-zA-Z0-9_-]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -203,7 +207,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", "2022-10-12")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -216,10 +220,10 @@ def build_delete_request( "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), - "fileSystemName": _SERIALIZER.url("file_system_name", file_system_name, "str"), + "fileSystemName": _SERIALIZER.url("file_system_name", file_system_name, "str", pattern=r"^[a-zA-Z0-9_-]*$"), } - _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -253,7 +257,6 @@ class FileSystemsOperations: def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.FileSystemResource"]: """List FileSystemResource resources by subscription ID. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileSystemResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.qumulo.models.FileSystemResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -264,7 +267,7 @@ class FileSystemsOperations: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileSystemResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -275,15 +278,13 @@ class FileSystemsOperations: 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.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -295,13 +296,12 @@ class FileSystemsOperations: } ) _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FileSystemResourceListResult", pipeline_response) @@ -311,11 +311,11 @@ class FileSystemsOperations: 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 @@ -328,8 +328,6 @@ class FileSystemsOperations: return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Qumulo.Storage/fileSystems"} - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.FileSystemResource"]: """List FileSystemResource resources by resource group. @@ -337,7 +335,6 @@ class FileSystemsOperations: :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 FileSystemResource or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.qumulo.models.FileSystemResource] :raises ~azure.core.exceptions.HttpResponseError: @@ -348,7 +345,7 @@ class FileSystemsOperations: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileSystemResourceListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -359,16 +356,14 @@ class FileSystemsOperations: 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.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -380,13 +375,12 @@ class FileSystemsOperations: } ) _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.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FileSystemResourceListResult", pipeline_response) @@ -396,11 +390,11 @@ class FileSystemsOperations: 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 @@ -413,10 +407,6 @@ class FileSystemsOperations: return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems" - } - @distributed_trace def get(self, resource_group_name: str, file_system_name: str, **kwargs: Any) -> _models.FileSystemResource: """Get a FileSystemResource. @@ -426,12 +416,11 @@ class FileSystemsOperations: :type resource_group_name: str :param file_system_name: Name of the File System resource. Required. :type file_system_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileSystemResource or the result of cls(response) :rtype: ~azure.mgmt.qumulo.models.FileSystemResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -445,21 +434,19 @@ class FileSystemsOperations: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileSystemResource] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, file_system_name=file_system_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.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 @@ -469,25 +456,21 @@ class FileSystemsOperations: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileSystemResource", pipeline_response) + deserialized = self._deserialize("FileSystemResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } + return deserialized # type: ignore def _create_or_update_initial( self, resource_group_name: str, file_system_name: str, - resource: Union[_models.FileSystemResource, IO], + resource: Union[_models.FileSystemResource, IO[bytes]], **kwargs: Any - ) -> _models.FileSystemResource: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -500,17 +483,17 @@ class FileSystemsOperations: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FileSystemResource] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None - if isinstance(resource, (IO, bytes)): + if isinstance(resource, (IOBase, bytes)): _content = resource else: _json = self._serialize.body(resource, "FileSystemResource") - request = build_create_or_update_request( + _request = build_create_or_update_request( resource_group_name=resource_group_name, file_system_name=file_system_name, subscription_id=self._config.subscription_id, @@ -518,40 +501,41 @@ class FileSystemsOperations: content_type=content_type, json=_json, content=_content, - template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request.url = self._client.format_url(_request.url) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + response_headers = {} if response.status_code == 200: - deserialized = self._deserialize("FileSystemResource", pipeline_response) + deserialized = response.stream_download(self._client._pipeline) if response.status_code == 201: - deserialized = self._deserialize("FileSystemResource", pipeline_response) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline) if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore + return cls(pipeline_response, deserialized, response_headers) # type: ignore return deserialized # type: ignore - _create_or_update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } - @overload def begin_create_or_update( self, @@ -574,14 +558,6 @@ class FileSystemsOperations: :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 FileSystemResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.qumulo.models.FileSystemResource] @@ -593,7 +569,7 @@ class FileSystemsOperations: self, resource_group_name: str, file_system_name: str, - resource: IO, + resource: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -606,18 +582,10 @@ class FileSystemsOperations: :param file_system_name: Name of the File System resource. Required. :type file_system_name: str :param resource: Resource create parameters. Required. - :type resource: IO + :type resource: 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 FileSystemResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.qumulo.models.FileSystemResource] @@ -629,7 +597,7 @@ class FileSystemsOperations: self, resource_group_name: str, file_system_name: str, - resource: Union[_models.FileSystemResource, IO], + resource: Union[_models.FileSystemResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.FileSystemResource]: """Create a FileSystemResource. @@ -639,20 +607,9 @@ class FileSystemsOperations: :type resource_group_name: str :param file_system_name: Name of the File System resource. Required. :type file_system_name: str - :param resource: Resource create parameters. Is either a FileSystemResource type or a IO type. - Required. - :type resource: ~azure.mgmt.qumulo.models.FileSystemResource 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 resource: Resource create parameters. Is either a FileSystemResource type or a IO[bytes] + type. Required. + :type resource: ~azure.mgmt.qumulo.models.FileSystemResource or IO[bytes] :return: An instance of LROPoller that returns either FileSystemResource or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.qumulo.models.FileSystemResource] @@ -679,12 +636,13 @@ class FileSystemsOperations: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FileSystemResource", pipeline_response) + deserialized = self._deserialize("FileSystemResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -696,17 +654,15 @@ class FileSystemsOperations: else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.FileSystemResource].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create_or_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } + return LROPoller[_models.FileSystemResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @overload def update( @@ -730,7 +686,6 @@ class FileSystemsOperations: :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileSystemResource or the result of cls(response) :rtype: ~azure.mgmt.qumulo.models.FileSystemResource :raises ~azure.core.exceptions.HttpResponseError: @@ -741,7 +696,7 @@ class FileSystemsOperations: self, resource_group_name: str, file_system_name: str, - properties: IO, + properties: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -754,11 +709,10 @@ class FileSystemsOperations: :param file_system_name: Name of the File System resource. Required. :type file_system_name: str :param properties: The resource properties to be updated. Required. - :type properties: IO + :type properties: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileSystemResource or the result of cls(response) :rtype: ~azure.mgmt.qumulo.models.FileSystemResource :raises ~azure.core.exceptions.HttpResponseError: @@ -769,7 +723,7 @@ class FileSystemsOperations: self, resource_group_name: str, file_system_name: str, - properties: Union[_models.FileSystemResourceUpdate, IO], + properties: Union[_models.FileSystemResourceUpdate, IO[bytes]], **kwargs: Any ) -> _models.FileSystemResource: """Update a FileSystemResource. @@ -780,17 +734,13 @@ class FileSystemsOperations: :param file_system_name: Name of the File System resource. Required. :type file_system_name: str :param properties: The resource properties to be updated. Is either a FileSystemResourceUpdate - type or a IO type. Required. - :type properties: ~azure.mgmt.qumulo.models.FileSystemResourceUpdate or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + type or a IO[bytes] type. Required. + :type properties: ~azure.mgmt.qumulo.models.FileSystemResourceUpdate or IO[bytes] :return: FileSystemResource or the result of cls(response) :rtype: ~azure.mgmt.qumulo.models.FileSystemResource :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -808,12 +758,12 @@ class FileSystemsOperations: content_type = content_type or "application/json" _json = None _content = None - if isinstance(properties, (IO, bytes)): + if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "FileSystemResourceUpdate") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, file_system_name=file_system_name, subscription_id=self._config.subscription_id, @@ -821,16 +771,14 @@ class FileSystemsOperations: content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _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 @@ -840,21 +788,15 @@ class FileSystemsOperations: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileSystemResource", pipeline_response) + deserialized = self._deserialize("FileSystemResource", pipeline_response.http_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } - - def _delete_initial( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, file_system_name: str, **kwargs: Any - ) -> None: - error_map = { + def _delete_initial(self, resource_group_name: str, file_system_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -866,38 +808,48 @@ class FileSystemsOperations: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, file_system_name=file_system_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.url = self._client.format_url(_request.url) - _stream = False + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response - if response.status_code not in [200, 202, 204]: + if response.status_code not in [202, 204]: + response.read() # Load the body in memory and close the socket map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - if cls: - return cls(pipeline_response, None, {}) + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" - } + deserialized = response.stream_download(self._client._pipeline) + + if response.status_code == 204: + deserialized = response.stream_download(self._client._pipeline) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, file_system_name: str, **kwargs: Any) -> LROPoller[None]: @@ -908,14 +860,6 @@ class FileSystemsOperations: :type resource_group_name: str :param file_system_name: Name of the File System resource. Required. :type file_system_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: @@ -929,7 +873,7 @@ class FileSystemsOperations: lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._delete_initial( # type: ignore + raw_result = self._delete_initial( resource_group_name=resource_group_name, file_system_name=file_system_name, api_version=api_version, @@ -938,29 +882,26 @@ class FileSystemsOperations: params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: - return LROPoller.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/Qumulo.Storage/fileSystems/{fileSystemName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/operations/_operations.py b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/operations/_operations.py index ef355821c0f..a066e480da1 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/operations/_operations.py +++ b/sdk/qumulo/azure-mgmt-qumulo/azure/mgmt/qumulo/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 ( @@ -19,16 +20,18 @@ from azure.core.exceptions import ( ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models 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 +43,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", "2022-10-12")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-06-19")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +81,6 @@ class Operations: def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """List the operations for the provider. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.qumulo.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,7 +91,7 @@ class Operations: 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 +102,12 @@ class Operations: 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.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +119,12 @@ class Operations: } ) _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.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 +134,11 @@ class Operations: return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +150,3 @@ class Operations: return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Qumulo.Storage/operations"} diff --git a/sdk/qumulo/azure-mgmt-qumulo/dev_requirements.txt b/sdk/qumulo/azure-mgmt-qumulo/dev_requirements.txt index dab09d85baf..181b6632ed6 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/dev_requirements.txt +++ b/sdk/qumulo/azure-mgmt-qumulo/dev_requirements.txt @@ -1,2 +1,3 @@ -e ../../../tools/azure-sdk-tools ../../identity/azure-identity +aiohttp \ No newline at end of file diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_create_or_update_maximum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_create_or_update_maximum_set_gen.py index 72a21c0f549..bebfa474217 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_create_or_update_maximum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_create_or_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.qumulo import QumuloMgmtClient """ @@ -26,39 +29,38 @@ from azure.mgmt.qumulo import QumuloMgmtClient def main(): client = QumuloMgmtClient( credential=DefaultAzureCredential(), - subscription_id="ulseeqylxb", + subscription_id="382E8C7A-AC80-4D70-8580-EFE99537B9B7", ) response = client.file_systems.begin_create_or_update( resource_group_name="rgQumulo", - file_system_name="nauwwbfoqehgbhdsmkewoboyxeqg", + file_system_name="hfcmtgaes", resource={ - "identity": {"type": "None", "userAssignedIdentities": {"key4522": {}}}, - "location": "przdlsmlzsszphnixq", + "identity": {"type": "None", "userAssignedIdentities": {"key7679": {}}}, + "location": "pnb", "properties": { - "adminPassword": "ekceujoecaashtjlsgcymnrdozk", - "availabilityZone": "maseyqhlnhoiwbabcqabtedbjpip", - "clusterLoginUrl": "jjqhgevy", - "delegatedSubnetId": "neqctctqdmjezfgt", - "initialCapacity": 9, + "adminPassword": "fakeTestSecretPlaceholder", + "availabilityZone": "eqdvbdiuwmhhzqzmksmwllpddqquwt", + "clusterLoginUrl": "ykaynsjvhihdthkkvvodjrgc", + "delegatedSubnetId": "jykmxrf", "marketplaceDetails": { - "marketplaceSubscriptionId": "ujrcqvxfnhxxheoth", + "marketplaceSubscriptionId": "xaqtkloiyovmexqhn", "marketplaceSubscriptionStatus": "PendingFulfillmentStart", - "offerId": "eiyhbmpwgezcmzrrfoiskuxlcvwojf", - "planId": "x", - "publisherId": "wfmokfdjbwpjhz", + "offerId": "s", + "planId": "fwtpz", + "publisherId": "czxcfrwodazyaft", + "termUnit": "cfwwczmygsimcyvoclcw", }, - "privateIPs": ["kslguxrwbwkrj"], - "provisioningState": "Accepted", - "storageSku": "Standard", - "userDetails": {"email": "viptslwulnpaupfljvnjeq"}, + "privateIPs": ["gzken"], + "storageSku": "yhyzby", + "userDetails": {"email": "aqsnzyroo"}, }, - "tags": {"key6565": "cgdhmupta"}, + "tags": {"key7090": "rurrdiaqp"}, }, ).result() print(response) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_CreateOrUpdate_MaximumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_CreateOrUpdate_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_create_or_update_minimum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_create_or_update_minimum_set_gen.py index f381dd17090..4fb5795c62b 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_create_or_update_minimum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_create_or_update_minimum_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.qumulo import QumuloMgmtClient """ @@ -35,17 +38,14 @@ def main(): resource={ "location": "aaaaaaaaaaaaaaaaaaaaaaaaa", "properties": { - "adminPassword": "ekceujoecaashtjlsgcymnrdozk", + "adminPassword": "fakeTestSecretPlaceholder", "delegatedSubnetId": "aaaaaaaaaa", - "initialCapacity": 9, "marketplaceDetails": { "marketplaceSubscriptionId": "aaaaaaaaaaaaa", "marketplaceSubscriptionStatus": "PendingFulfillmentStart", "offerId": "aaaaaaaaaaaaaaaaaaaaaaaaa", "planId": "aaaaaa", - "publisherId": "aa", }, - "provisioningState": "Accepted", "storageSku": "Standard", "userDetails": {"email": "viptslwulnpaupfljvnjeq"}, }, @@ -54,6 +54,6 @@ def main(): print(response) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_CreateOrUpdate_MinimumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_CreateOrUpdate_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_delete_maximum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_delete_maximum_set_gen.py index 342d8fddf02..720e549a90d 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_delete_maximum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_delete_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -26,16 +27,15 @@ from azure.mgmt.qumulo import QumuloMgmtClient def main(): client = QumuloMgmtClient( credential=DefaultAzureCredential(), - subscription_id="ulseeqylxb", + subscription_id="382E8C7A-AC80-4D70-8580-EFE99537B9B7", ) - response = client.file_systems.begin_delete( + client.file_systems.begin_delete( resource_group_name="rgQumulo", - file_system_name="nauwwbfoqehgbhdsmkewoboyxeqg", + file_system_name="xoschzkccroahrykedlvbbnsddq", ).result() - print(response) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_Delete_MaximumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Delete_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_delete_minimum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_delete_minimum_set_gen.py index 237cf61ed20..034dbd9b669 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_delete_minimum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_delete_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -26,16 +27,15 @@ from azure.mgmt.qumulo import QumuloMgmtClient def main(): client = QumuloMgmtClient( credential=DefaultAzureCredential(), - subscription_id="ulseeqylxb", + subscription_id="382E8C7A-AC80-4D70-8580-EFE99537B9B7", ) - response = client.file_systems.begin_delete( + client.file_systems.begin_delete( resource_group_name="rgQumulo", - file_system_name="nauwwbfoqehgbhdsmkewoboyxeqg", + file_system_name="jgtskkiplquyrlkaxvhdg", ).result() - print(response) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_Delete_MinimumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Delete_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_get_maximum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_get_maximum_set_gen.py index 42b6c6c56a3..6a904b4d541 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_get_maximum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_get_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -26,16 +27,16 @@ from azure.mgmt.qumulo import QumuloMgmtClient def main(): client = QumuloMgmtClient( credential=DefaultAzureCredential(), - subscription_id="ulseeqylxb", + subscription_id="382E8C7A-AC80-4D70-8580-EFE99537B9B7", ) response = client.file_systems.get( resource_group_name="rgQumulo", - file_system_name="nauwwbfoqehgbhdsmkewoboyxeqg", + file_system_name="sihbehcisdqtqqyfiewiiaphgh", ) print(response) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_Get_MaximumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Get_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_get_minimum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_get_minimum_set_gen.py index 5c96345352a..a087f26e0ea 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_get_minimum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_get_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_Get_MinimumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Get_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_resource_group_maximum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_resource_group_maximum_set_gen.py index a829e6234b1..358005f12ff 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_resource_group_maximum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_resource_group_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -26,7 +27,7 @@ from azure.mgmt.qumulo import QumuloMgmtClient def main(): client = QumuloMgmtClient( credential=DefaultAzureCredential(), - subscription_id="ulseeqylxb", + subscription_id="382E8C7A-AC80-4D70-8580-EFE99537B9B7", ) response = client.file_systems.list_by_resource_group( @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_ListByResourceGroup_MaximumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_ListByResourceGroup_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_resource_group_minimum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_resource_group_minimum_set_gen.py index 5c591b532ae..e166a2bc1e7 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_resource_group_minimum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_resource_group_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_ListByResourceGroup_MinimumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_ListByResourceGroup_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_subscription_maximum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_subscription_maximum_set_gen.py index 07d6814c641..deba75c9ad8 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_subscription_maximum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_subscription_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -26,7 +27,7 @@ from azure.mgmt.qumulo import QumuloMgmtClient def main(): client = QumuloMgmtClient( credential=DefaultAzureCredential(), - subscription_id="ulseeqylxb", + subscription_id="382E8C7A-AC80-4D70-8580-EFE99537B9B7", ) response = client.file_systems.list_by_subscription() @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_ListBySubscription_MaximumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_ListBySubscription_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_subscription_minimum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_subscription_minimum_set_gen.py index 85544348d9d..27dda33a5ae 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_subscription_minimum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_list_by_subscription_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_ListBySubscription_MinimumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_ListBySubscription_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_update_maximum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_update_maximum_set_gen.py index 8e9933f4bc7..f9c0ac72d88 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_update_maximum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/file_systems_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.qumulo import QumuloMgmtClient """ @@ -26,33 +29,32 @@ from azure.mgmt.qumulo import QumuloMgmtClient def main(): client = QumuloMgmtClient( credential=DefaultAzureCredential(), - subscription_id="ulseeqylxb", + subscription_id="382E8C7A-AC80-4D70-8580-EFE99537B9B7", ) response = client.file_systems.update( resource_group_name="rgQumulo", - file_system_name="nauwwbfoqehgbhdsmkewoboyxeqg", + file_system_name="ahpixnvykleksjlr", properties={ - "identity": {"type": "None", "userAssignedIdentities": {"key4522": {}}}, + "identity": {"type": "None", "userAssignedIdentities": {"key7679": {}}}, "properties": { - "clusterLoginUrl": "adabmuthwrbjshzfbo", - "delegatedSubnetId": "vjfirtaljehawmflyfianw", + "delegatedSubnetId": "bqaryqsjlackxphpmzffgoqsvm", "marketplaceDetails": { - "marketplaceSubscriptionId": "ujrcqvxfnhxxheoth", + "marketplaceSubscriptionId": "xaqtkloiyovmexqhn", "marketplaceSubscriptionStatus": "PendingFulfillmentStart", - "offerId": "eiyhbmpwgezcmzrrfoiskuxlcvwojf", - "planId": "x", - "publisherId": "wfmokfdjbwpjhz", + "offerId": "s", + "planId": "fwtpz", + "publisherId": "czxcfrwodazyaft", + "termUnit": "cfwwczmygsimcyvoclcw", }, - "privateIPs": ["eugjqbaoucgjsopzfrq"], - "userDetails": {"email": "aa"}, + "userDetails": {"email": "aqsnzyroo"}, }, - "tags": {"key7534": "jsgqvqbagquvxowbrkanyhzvo"}, + "tags": {"key357": "ztkkvhfia"}, }, ) print(response) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/FileSystems_Update_MaximumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Update_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/operations_list_maximum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/operations_list_maximum_set_gen.py index a0a6dc4ac00..936842dfc43 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/operations_list_maximum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/operations_list_maximum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/Operations_List_MaximumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/Operations_List_MaximumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/operations_list_minimum_set_gen.py b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/operations_list_minimum_set_gen.py index 8b22c5509a3..196b41b2da1 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/generated_samples/operations_list_minimum_set_gen.py +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_samples/operations_list_minimum_set_gen.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.qumulo import QumuloMgmtClient """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2022-10-12/examples/Operations_List_MinimumSet_Gen.json +# x-ms-original-file: specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/Operations_List_MinimumSet_Gen.json if __name__ == "__main__": main() diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_tests/conftest.py b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/conftest.py new file mode 100644 index 00000000000..c5b980e1b61 --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + qumulomgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + qumulomgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + qumulomgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + qumulomgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=qumulomgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=qumulomgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=qumulomgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=qumulomgmt_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_file_systems_operations.py b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_file_systems_operations.py new file mode 100644 index 00000000000..2aa91ee1d07 --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_file_systems_operations.py @@ -0,0 +1,146 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.qumulo import QumuloMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestQumuloMgmtFileSystemsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(QumuloMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_subscription(self, resource_group): + response = self.client.file_systems.list_by_subscription( + api_version="2024-06-19", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.file_systems.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-19", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.file_systems.get( + resource_group_name=resource_group.name, + file_system_name="str", + api_version="2024-06-19", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.file_systems.begin_create_or_update( + resource_group_name=resource_group.name, + file_system_name="str", + resource={ + "location": "str", + "adminPassword": "str", + "availabilityZone": "str", + "clusterLoginUrl": "str", + "delegatedSubnetId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "marketplaceDetails": { + "offerId": "str", + "planId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + "publisherId": "str", + "termUnit": "str", + }, + "name": "str", + "privateIPs": ["str"], + "provisioningState": "str", + "storageSku": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "userDetails": {"email": "str"}, + }, + api_version="2024-06-19", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.file_systems.update( + resource_group_name=resource_group.name, + file_system_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "delegatedSubnetId": "str", + "marketplaceDetails": { + "offerId": "str", + "planId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + "publisherId": "str", + "termUnit": "str", + }, + "userDetails": {"email": "str"}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-06-19", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_delete(self, resource_group): + response = self.client.file_systems.begin_delete( + resource_group_name=resource_group.name, + file_system_name="str", + api_version="2024-06-19", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_file_systems_operations_async.py b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_file_systems_operations_async.py new file mode 100644 index 00000000000..ec9b37316cf --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_file_systems_operations_async.py @@ -0,0 +1,151 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.qumulo.aio import QumuloMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestQumuloMgmtFileSystemsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(QumuloMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_subscription(self, resource_group): + response = self.client.file_systems.list_by_subscription( + api_version="2024-06-19", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.file_systems.list_by_resource_group( + resource_group_name=resource_group.name, + api_version="2024-06-19", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.file_systems.get( + resource_group_name=resource_group.name, + file_system_name="str", + api_version="2024-06-19", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.file_systems.begin_create_or_update( + resource_group_name=resource_group.name, + file_system_name="str", + resource={ + "location": "str", + "adminPassword": "str", + "availabilityZone": "str", + "clusterLoginUrl": "str", + "delegatedSubnetId": "str", + "id": "str", + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "marketplaceDetails": { + "offerId": "str", + "planId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + "publisherId": "str", + "termUnit": "str", + }, + "name": "str", + "privateIPs": ["str"], + "provisioningState": "str", + "storageSku": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "tags": {"str": "str"}, + "type": "str", + "userDetails": {"email": "str"}, + }, + api_version="2024-06-19", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.file_systems.update( + resource_group_name=resource_group.name, + file_system_name="str", + properties={ + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, + "properties": { + "delegatedSubnetId": "str", + "marketplaceDetails": { + "offerId": "str", + "planId": "str", + "marketplaceSubscriptionId": "str", + "marketplaceSubscriptionStatus": "str", + "publisherId": "str", + "termUnit": "str", + }, + "userDetails": {"email": "str"}, + }, + "tags": {"str": "str"}, + }, + api_version="2024-06-19", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_delete(self, resource_group): + response = await ( + await self.client.file_systems.begin_delete( + resource_group_name=resource_group.name, + file_system_name="str", + api_version="2024-06-19", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_operations.py b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_operations.py new file mode 100644 index 00000000000..fe19f638efa --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.qumulo import QumuloMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestQumuloMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(QumuloMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-06-19", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_operations_async.py b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_operations_async.py new file mode 100644 index 00000000000..9dedb4e7a3c --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/generated_tests/test_qumulo_mgmt_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.qumulo.aio import QumuloMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestQumuloMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(QumuloMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list( + api_version="2024-06-19", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/qumulo/azure-mgmt-qumulo/sdk_packaging.toml b/sdk/qumulo/azure-mgmt-qumulo/sdk_packaging.toml index bc05d9ae4c9..3b766b3ca5c 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/sdk_packaging.toml +++ b/sdk/qumulo/azure-mgmt-qumulo/sdk_packaging.toml @@ -3,7 +3,7 @@ package_name = "azure-mgmt-qumulo" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Qumulo Management" package_doc_id = "" -is_stable = false +is_stable = true is_arm = true need_msrestazure = false need_azuremgmtcore = true diff --git a/sdk/qumulo/azure-mgmt-qumulo/setup.py b/sdk/qumulo/azure-mgmt-qumulo/setup.py index a4940fec216..23a2d50177f 100644 --- a/sdk/qumulo/azure-mgmt-qumulo/setup.py +++ b/sdk/qumulo/azure-mgmt-qumulo/setup.py @@ -1,10 +1,10 @@ #!/usr/bin/env python -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- import re import os.path @@ -16,64 +16,68 @@ PACKAGE_NAME = "azure-mgmt-qumulo" PACKAGE_PPRINT_NAME = "Qumulo Management" # a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace('-', '/') +package_folder_path = PACKAGE_NAME.replace("-", "/") # a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace('-', '.') +namespace_name = PACKAGE_NAME.replace("-", ".") # Version extraction inspired from 'requests' -with open(os.path.join(package_folder_path, 'version.py') - if os.path.exists(os.path.join(package_folder_path, 'version.py')) - else os.path.join(package_folder_path, '_version.py'), 'r') as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', - fd.read(), re.MULTILINE).group(1) +with open( + os.path.join(package_folder_path, "version.py") + if os.path.exists(os.path.join(package_folder_path, "version.py")) + else os.path.join(package_folder_path, "_version.py"), + "r", +) as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) if not version: - raise RuntimeError('Cannot find version information') + raise RuntimeError("Cannot find version information") -with open('README.md', encoding='utf-8') as f: +with open("README.md", encoding="utf-8") as f: readme = f.read() -with open('CHANGELOG.md', encoding='utf-8') as f: +with open("CHANGELOG.md", encoding="utf-8") as f: changelog = f.read() setup( name=PACKAGE_NAME, version=version, - description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), - long_description=readme + '\n\n' + changelog, - long_description_content_type='text/markdown', - license='MIT License', - author='Microsoft Corporation', - author_email='azpysdkhelp@microsoft.com', - url='https://github.com/Azure/azure-sdk-for-python', + description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), + long_description=readme + "\n\n" + changelog, + long_description_content_type="text/markdown", + license="MIT License", + author="Microsoft Corporation", + author_email="azpysdkhelp@microsoft.com", + url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - 'Development Status :: 4 - Beta', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3 :: Only', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - 'Programming Language :: Python :: 3.11', - 'License :: OSI Approved :: MIT License', + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "License :: OSI Approved :: MIT License", ], zip_safe=False, - packages=find_packages(exclude=[ - 'tests', - # Exclude packages that will be covered by PEP420 or nspkg - 'azure', - 'azure.mgmt', - ]), + packages=find_packages( + exclude=[ + "tests", + # Exclude packages that will be covered by PEP420 or nspkg + "azure", + "azure.mgmt", + ] + ), include_package_data=True, package_data={ - 'pytyped': ['py.typed'], + "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "typing-extensions>=4.6.0", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7" + python_requires=">=3.8", ) diff --git a/sdk/qumulo/azure-mgmt-qumulo/tests/conftest.py b/sdk/qumulo/azure-mgmt-qumulo/tests/conftest.py new file mode 100644 index 00000000000..c5b980e1b61 --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# aovid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + qumulomgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + qumulomgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + qumulomgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + qumulomgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=qumulomgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=qumulomgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=qumulomgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=qumulomgmt_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_file_systems_operations_async_test.py b/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_file_systems_operations_async_test.py new file mode 100644 index 00000000000..081de28b868 --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_file_systems_operations_async_test.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.qumulo.aio import QumuloMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.live_test_only +class TestQumuloMgmtFileSystemsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(QumuloMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_resource_group(self, resource_group): + response = self.client.file_systems.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + assert result == [] + \ No newline at end of file diff --git a/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_file_systems_operations_test.py b/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_file_systems_operations_test.py new file mode 100644 index 00000000000..6abcf1db00b --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_file_systems_operations_test.py @@ -0,0 +1,27 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.qumulo import QumuloMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.live_test_only +class TestQumuloMgmtFileSystemsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(QumuloMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_resource_group(self, resource_group): + response = self.client.file_systems.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + assert result == [] diff --git a/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_operations_async_test.py b/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_operations_async_test.py new file mode 100644 index 00000000000..ceaa3d2fccf --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_operations_async_test.py @@ -0,0 +1,26 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.qumulo.aio import QumuloMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + +@pytest.mark.live_test_only +class TestQumuloMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(QumuloMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + assert result diff --git a/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_operations_test.py b/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_operations_test.py new file mode 100644 index 00000000000..d88477cd7ae --- /dev/null +++ b/sdk/qumulo/azure-mgmt-qumulo/tests/test_qumulo_mgmt_operations_test.py @@ -0,0 +1,25 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.qumulo import QumuloMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + +@pytest.mark.live_test_only +class TestQumuloMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(QumuloMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + assert result