diff --git a/sdk/storageactions/azure-mgmt-storageactions/_meta.json b/sdk/storageactions/azure-mgmt-storageactions/_meta.json index db829621ac16..9d1b53114540 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/_meta.json +++ b/sdk/storageactions/azure-mgmt-storageactions/_meta.json @@ -1,11 +1,11 @@ { - "commit": "f36fad422c8d60ebdf5010840320a38248be19ab", + "commit": "8cbc671daa5e025927f2d983151cbcfe1f4b6ec0", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.16", + "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/storageactions/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/storageactions/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.13.16 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/storageactions/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_configuration.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_configuration.py index 4644a32ff39f..952eeabe9488 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_configuration.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class StorageActionsMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class StorageActionsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for StorageActionsMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -35,7 +34,6 @@ class StorageActionsMgmtClientConfiguration(Configuration): # pylint: disable=t """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(StorageActionsMgmtClientConfiguration, self).__init__(**kwargs) api_version: str = kwargs.pop("api_version", "2023-01-01") if credential is None: @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-storageactions/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_serialization.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_serialization.py index 4bae2292227b..2f781d740827 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_serialization.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :keyword bool skip_quote: Whether to skip quote the serialized result. Defaults to False. - :rtype: str + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_storage_actions_mgmt_client.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_storage_actions_mgmt_client.py index ba3a846b360b..636f44110ab0 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_storage_actions_mgmt_client.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/_storage_actions_mgmt_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import StorageActionsMgmtClientConfiguration @@ -63,7 +65,25 @@ def __init__( self._config = StorageActionsMgmtClientConfiguration( 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) @@ -78,7 +98,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -98,7 +118,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_configuration.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_configuration.py index b6a5110cb1ed..76bee344c50f 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_configuration.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class StorageActionsMgmtClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class StorageActionsMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for StorageActionsMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -35,7 +34,6 @@ class StorageActionsMgmtClientConfiguration(Configuration): # pylint: disable=t """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - super(StorageActionsMgmtClientConfiguration, self).__init__(**kwargs) api_version: str = kwargs.pop("api_version", "2023-01-01") if credential is None: @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-storageactions/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_storage_actions_mgmt_client.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_storage_actions_mgmt_client.py index e4da11ca2ec9..8f452415ab07 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_storage_actions_mgmt_client.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/_storage_actions_mgmt_client.py @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -63,7 +65,25 @@ def __init__( self._config = StorageActionsMgmtClientConfiguration( 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) @@ -78,7 +98,9 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -98,7 +120,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_operations.py index 221d10c050f4..de6f843e21d2 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_operations.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """Lists all of the available Storage Actions Rest API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storageactions.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -67,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -78,14 +82,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +100,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -113,11 +116,11 @@ async def extract_data(pipeline_response): return 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 +132,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.StorageActions/operations"} diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_task_assignment_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_task_assignment_operations.py index 4786ed2610a5..b63154d1911f 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_task_assignment_operations.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_task_assignment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._storage_task_assignment_operations import build_list_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,7 +61,7 @@ def __init__(self, *args, **kwargs) -> None: def list( self, resource_group_name: str, storage_task_name: str, maxpagesize: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.StorageTaskAssignment"]: - """Lists all the storage tasks available under the given resource group. + """Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -65,10 +70,9 @@ def list( Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. Required. :type storage_task_name: str - :param maxpagesize: Optional, specifies the maximum number of storage task assignment Ids to be - included in the list response. Default value is None. + :param maxpagesize: Optional, specifies the maximum number of Storage Task Assignment Resource + IDs to be included in the list response. Default value is None. :type maxpagesize: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTaskAssignment or the result of cls(response) :rtype: @@ -81,7 +85,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTaskAssignmentsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,18 +96,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -115,13 +118,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("StorageTaskAssignmentsListResult", pipeline_response) @@ -131,11 +134,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -147,7 +150,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments" - } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_operations.py index 1400e7e209ec..44a84d1c76bb 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_operations.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -41,6 +42,10 @@ build_update_request, ) +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -68,10 +73,10 @@ async def _create_initial( self, resource_group_name: str, storage_task_name: str, - parameters: Union[_models.StorageTask, IO], + parameters: Union[_models.StorageTask, IO[bytes]], **kwargs: Any ) -> Optional[_models.StorageTask]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -94,7 +99,7 @@ async def _create_initial( else: _json = self._serialize.body(parameters, "StorageTask") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, @@ -102,16 +107,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -133,13 +137,9 @@ async def _create_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -169,14 +169,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -188,7 +180,7 @@ async def begin_create( self, resource_group_name: str, storage_task_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -207,18 +199,10 @@ async def begin_create( letters only. Required. :type storage_task_name: str :param parameters: The parameters to create a Storage Task. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -230,7 +214,7 @@ async def begin_create( self, resource_group_name: str, storage_task_name: str, - parameters: Union[_models.StorageTask, IO], + parameters: Union[_models.StorageTask, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.StorageTask]: """Asynchronously creates a new storage task resource with the specified parameters. If a storage @@ -247,19 +231,8 @@ async def begin_create( letters only. Required. :type storage_task_name: str :param parameters: The parameters to create a Storage Task. Is either a StorageTask type or a - IO type. Required. - :type parameters: ~azure.mgmt.storageactions.models.StorageTask 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. + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTask or IO[bytes] :return: An instance of AsyncLROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -291,7 +264,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("StorageTask", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -303,22 +276,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.StorageTask].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return AsyncLROPoller[_models.StorageTask]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, storage_task_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -332,21 +303,20 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -361,11 +331,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace_async async def begin_delete( @@ -380,14 +346,6 @@ async def begin_delete( Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. Required. :type storage_task_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: @@ -414,7 +372,7 @@ async def begin_delete( def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: - return cls(pipeline_response, None, {}) + return cls(pipeline_response, None, {}) # type: ignore if polling is True: polling_method: AsyncPollingMethod = cast( @@ -425,17 +383,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace_async async def get(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) -> _models.StorageTask: @@ -448,12 +402,11 @@ async def get(self, resource_group_name: str, storage_task_name: str, **kwargs: Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. Required. :type storage_task_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageTask or the result of cls(response) :rtype: ~azure.mgmt.storageactions.models.StorageTask :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -467,21 +420,20 @@ async def get(self, resource_group_name: str, storage_task_name: str, **kwargs: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTask] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -494,22 +446,18 @@ async def get(self, resource_group_name: str, storage_task_name: str, **kwargs: deserialized = self._deserialize("StorageTask", pipeline_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/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return deserialized # type: ignore async def _update_initial( self, resource_group_name: str, storage_task_name: str, - parameters: Union[_models.StorageTaskUpdateParameters, IO], + parameters: Union[_models.StorageTaskUpdateParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.StorageTask]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -532,7 +480,7 @@ async def _update_initial( else: _json = self._serialize.body(parameters, "StorageTaskUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, @@ -540,16 +488,15 @@ async def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -568,13 +515,9 @@ async def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return deserialized # type: ignore @overload async def begin_update( @@ -600,14 +543,6 @@ async def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -619,7 +554,7 @@ async def begin_update( self, resource_group_name: str, storage_task_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -634,18 +569,10 @@ async def begin_update( letters only. Required. :type storage_task_name: str :param parameters: The parameters to provide to update the storage task resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -657,7 +584,7 @@ async def begin_update( self, resource_group_name: str, storage_task_name: str, - parameters: Union[_models.StorageTaskUpdateParameters, IO], + parameters: Union[_models.StorageTaskUpdateParameters, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.StorageTask]: """Update storage task properties. @@ -670,19 +597,8 @@ async def begin_update( letters only. Required. :type storage_task_name: str :param parameters: The parameters to provide to update the storage task resource. Is either a - StorageTaskUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.storageactions.models.StorageTaskUpdateParameters 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. + StorageTaskUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskUpdateParameters or IO[bytes] :return: An instance of AsyncLROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -714,7 +630,7 @@ async def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("StorageTask", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -726,23 +642,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.StorageTask].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return AsyncLROPoller[_models.StorageTask]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.StorageTask"]: """Lists all the storage tasks available under the subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTask or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storageactions.models.StorageTask] :raises ~azure.core.exceptions.HttpResponseError: @@ -753,7 +666,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.StorageT api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTasksListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -764,15 +677,14 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.StorageT def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -784,13 +696,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("StorageTasksListResult", pipeline_response) @@ -800,11 +712,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -817,10 +729,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.StorageTask"]: """Lists all the storage tasks available under the given resource group. @@ -828,7 +736,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTask or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.storageactions.models.StorageTask] :raises ~azure.core.exceptions.HttpResponseError: @@ -839,7 +746,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTasksListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -850,16 +757,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -871,13 +777,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("StorageTasksListResult", pipeline_response) @@ -887,11 +793,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -904,10 +810,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks" - } - @overload async def preview_actions( self, @@ -927,7 +829,6 @@ async def preview_actions( :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: StorageTaskPreviewAction or the result of cls(response) :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction :raises ~azure.core.exceptions.HttpResponseError: @@ -935,7 +836,7 @@ async def preview_actions( @overload async def preview_actions( - self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.StorageTaskPreviewAction: """Runs the input conditions against input object metadata properties and designates matched objects in response. @@ -943,11 +844,10 @@ async def preview_actions( :param location: The location to perform preview of the actions. Required. :type location: str :param parameters: The parameters to preview action condition. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageTaskPreviewAction or the result of cls(response) :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction :raises ~azure.core.exceptions.HttpResponseError: @@ -955,7 +855,7 @@ async def preview_actions( @distributed_trace_async async def preview_actions( - self, location: str, parameters: Union[_models.StorageTaskPreviewAction, IO], **kwargs: Any + self, location: str, parameters: Union[_models.StorageTaskPreviewAction, IO[bytes]], **kwargs: Any ) -> _models.StorageTaskPreviewAction: """Runs the input conditions against input object metadata properties and designates matched objects in response. @@ -963,17 +863,13 @@ async def preview_actions( :param location: The location to perform preview of the actions. Required. :type location: str :param parameters: The parameters to preview action condition. Is either a - StorageTaskPreviewAction type or a IO type. Required. - :type parameters: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction 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 + StorageTaskPreviewAction type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction or IO[bytes] :return: StorageTaskPreviewAction or the result of cls(response) :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -996,23 +892,22 @@ async def preview_actions( else: _json = self._serialize.body(parameters, "StorageTaskPreviewAction") - request = build_preview_actions_request( + _request = build_preview_actions_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.preview_actions.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1025,10 +920,6 @@ async def preview_actions( deserialized = self._deserialize("StorageTaskPreviewAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - preview_actions.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions" - } + return deserialized # type: ignore diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_report_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_report_operations.py index 9314ac871220..8a39e2dab82d 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_report_operations.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/aio/operations/_storage_tasks_report_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._storage_tasks_report_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]] @@ -70,13 +75,12 @@ def list( Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. Required. :type storage_task_name: str - :param maxpagesize: Optional, specifies the maximum number of storage task assignment Ids to be - included in the list response. Default value is None. + :param maxpagesize: Optional, specifies the maximum number of Storage Task Assignment Resource + IDs to be included in the list response. Default value is None. :type maxpagesize: str :param filter: Optional. When specified, it can be used to query using reporting properties. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTaskReportInstance or the result of cls(response) :rtype: @@ -89,7 +93,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTaskReportSummary] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,19 +104,18 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, maxpagesize=maxpagesize, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -124,13 +127,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("StorageTaskReportSummary", pipeline_response) @@ -140,11 +143,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,7 +159,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports" - } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_models_py3.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_models_py3.py index cdb153e331aa..a61aa7de5f1d 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_models_py3.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_models_py3.py @@ -8,16 +8,10 @@ # -------------------------------------------------------------------------- import datetime -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from .. import _serialization -if sys.version_info >= (3, 8): - from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports -else: - from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports - if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -26,7 +20,7 @@ class ElseCondition(_serialization.Model): """The else block of storage task 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 operations: List of operations to execute in the else block. Required. :vartype operations: list[~azure.mgmt.storageactions.models.StorageTaskOperation] @@ -144,10 +138,10 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A class IfCondition(_serialization.Model): """The if block of storage task 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 condition: The condition predicate which is composed of object properties, eg: blob and - container properties. Required. + :ivar condition: Condition predicate to evaluate each object. See + https://aka.ms/storagetaskconditions for valid properties and operators. Required. :vartype condition: str :ivar operations: List of operations to execute when the condition predicate satisfies. Required. @@ -166,8 +160,8 @@ class IfCondition(_serialization.Model): def __init__(self, *, condition: str, operations: List["_models.StorageTaskOperation"], **kwargs: Any) -> None: """ - :keyword condition: The condition predicate which is composed of object properties, eg: blob - and container properties. Required. + :keyword condition: Condition predicate to evaluate each object. See + https://aka.ms/storagetaskconditions for valid properties and operators. Required. :paramtype condition: str :keyword operations: List of operations to execute when the condition predicate satisfies. Required. @@ -183,7 +177,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. @@ -197,7 +191,7 @@ class ManagedServiceIdentity(_serialization.Model): :vartype type: str or ~azure.mgmt.storageactions.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.storageactions.models.UserAssignedIdentity] @@ -230,7 +224,7 @@ def __init__( :paramtype type: str or ~azure.mgmt.storageactions.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.storageactions.models.UserAssignedIdentity] @@ -369,7 +363,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. E.g. - "/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 @@ -411,7 +405,7 @@ class ProxyResource(Resource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/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 @@ -423,24 +417,6 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.storageactions.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which @@ -448,10 +424,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. E.g. - "/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 @@ -501,10 +477,10 @@ class StorageTask(TrackedResource): Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar id: Fully qualified resource ID for the resource. E.g. - "/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 @@ -518,9 +494,9 @@ class StorageTask(TrackedResource): :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. :vartype location: str - :ivar identity: The managed service identity of the resource. + :ivar identity: The managed service identity of the resource. Required. :vartype identity: ~azure.mgmt.storageactions.models.ManagedServiceIdentity - :ivar properties: Properties of the storage task. + :ivar properties: Properties of the storage task. Required. :vartype properties: ~azure.mgmt.storageactions.models.StorageTaskProperties """ @@ -530,6 +506,8 @@ class StorageTask(TrackedResource): "type": {"readonly": True}, "system_data": {"readonly": True}, "location": {"required": True}, + "identity": {"required": True}, + "properties": {"required": True}, } _attribute_map = { @@ -547,9 +525,9 @@ def __init__( self, *, location: str, + identity: "_models.ManagedServiceIdentity", + properties: "_models.StorageTaskProperties", tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - properties: Optional["_models.StorageTaskProperties"] = None, **kwargs: Any ) -> None: """ @@ -557,9 +535,9 @@ def __init__( :paramtype tags: dict[str, str] :keyword location: The geo-location where the resource lives. Required. :paramtype location: str - :keyword identity: The managed service identity of the resource. + :keyword identity: The managed service identity of the resource. Required. :paramtype identity: ~azure.mgmt.storageactions.models.ManagedServiceIdentity - :keyword properties: Properties of the storage task. + :keyword properties: Properties of the storage task. Required. :paramtype properties: ~azure.mgmt.storageactions.models.StorageTaskProperties """ super().__init__(tags=tags, location=location, **kwargs) @@ -571,7 +549,7 @@ class StorageTaskAction(_serialization.Model): """The storage task action represents conditional statements and operations to be performed on target objects. - 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 if_property: The if block of storage task operation. Required. :vartype if_property: ~azure.mgmt.storageactions.models.IfCondition @@ -607,11 +585,11 @@ def __init__( class StorageTaskAssignment(_serialization.Model): - """Fetch the Storage task assignment ARM ids. + """Storage Task Assignment associated with this Storage Task. Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: ARM Id of the storage task assignments, associated with the storage tasks. + :ivar id: Resource ID of the Storage Task Assignment. :vartype id: str """ @@ -634,11 +612,10 @@ class StorageTaskAssignmentsListResult(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar value: Gets the list of storage task assignment Ids. + :ivar value: List of Storage Task Assignment Resource IDs associated with this Storage Task. :vartype value: list[~azure.mgmt.storageactions.models.StorageTaskAssignment] - :ivar next_link: Request URL that can be used to query next page of storage task assignment - Ids. Returned when total number of requested storage task assignment Ids exceed maximum page - size. + :ivar next_link: Request URL that can be used to query next page of Resource IDs. Returned when + total number of requested Resource IDs exceed maximum page size. :vartype next_link: str """ @@ -662,7 +639,7 @@ def __init__(self, **kwargs: Any) -> None: class StorageTaskOperation(_serialization.Model): """Represents an operation to be performed on the object. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The operation to be performed on the object. Required. Known values are: "SetBlobTier", "SetBlobTags", "SetBlobImmutabilityPolicy", "SetBlobLegalHold", "SetBlobExpiry", @@ -722,7 +699,7 @@ def __init__( class StorageTaskPreviewAction(_serialization.Model): """Storage Task Preview Action. - 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 properties: Properties of the storage task preview. Required. :vartype properties: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionProperties @@ -749,7 +726,7 @@ class StorageTaskPreviewActionCondition(_serialization.Model): """Represents the storage task conditions to be tested for a match with container and blob properties. - 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 if_property: The condition to be tested for a match with container and blob properties. Required. @@ -807,16 +784,15 @@ def __init__(self, *, condition: Optional[str] = None, **kwargs: Any) -> None: class StorageTaskPreviewActionProperties(_serialization.Model): """Storage task preview action properties. - 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 container: Preview action container properties to be tested for a match with the provided - condition. Required. + :ivar container: Properties of a sample container to test for a match with the preview action. + Required. :vartype container: ~azure.mgmt.storageactions.models.StorageTaskPreviewContainerProperties - :ivar blobs: Preview action container properties to be tested for a match with the provided - condition. Required. + :ivar blobs: Properties of some sample blobs in the container to test for matches with the + preview action. Required. :vartype blobs: list[~azure.mgmt.storageactions.models.StorageTaskPreviewBlobProperties] - :ivar action: Preview action container properties to be tested for a match with the provided - condition. Required. + :ivar action: Preview action to test. Required. :vartype action: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionCondition """ @@ -841,14 +817,13 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword container: Preview action container properties to be tested for a match with the - provided condition. Required. + :keyword container: Properties of a sample container to test for a match with the preview + action. Required. :paramtype container: ~azure.mgmt.storageactions.models.StorageTaskPreviewContainerProperties - :keyword blobs: Preview action container properties to be tested for a match with the provided - condition. Required. + :keyword blobs: Properties of some sample blobs in the container to test for matches with the + preview action. Required. :paramtype blobs: list[~azure.mgmt.storageactions.models.StorageTaskPreviewBlobProperties] - :keyword action: Preview action container properties to be tested for a match with the provided - condition. Required. + :keyword action: Preview action to test. Required. :paramtype action: ~azure.mgmt.storageactions.models.StorageTaskPreviewActionCondition """ super().__init__(**kwargs) @@ -862,7 +837,7 @@ class StorageTaskPreviewBlobProperties(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar name: property for the container name. + :ivar name: Name of test blob. :vartype name: str :ivar properties: properties key value pairs to be tested for a match against the provided condition. @@ -874,7 +849,7 @@ class StorageTaskPreviewBlobProperties(_serialization.Model): :ivar tags: tags key value pairs to be tested for a match against the provided condition. :vartype tags: list[~azure.mgmt.storageactions.models.StorageTaskPreviewKeyValueProperties] :ivar matched_block: Represents the condition block name that matched blob properties. Known - values are: "If", "Else", "None", "If", and "Else". + values are: "If", "Else", and "None". :vartype matched_block: str or ~azure.mgmt.storageactions.models.MatchedBlockName """ @@ -900,7 +875,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword name: property for the container name. + :keyword name: Name of test blob. :paramtype name: str :keyword properties: properties key value pairs to be tested for a match against the provided condition. @@ -924,7 +899,7 @@ def __init__( class StorageTaskPreviewContainerProperties(_serialization.Model): """Storage task preview container properties. - :ivar name: property for the container name. + :ivar name: Name of test container. :vartype name: str :ivar metadata: metadata key value pairs to be tested for a match against the provided condition. @@ -944,7 +919,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword name: property for the container name. + :keyword name: Name of test container. :paramtype name: str :keyword metadata: metadata key value pairs to be tested for a match against the provided condition. @@ -987,7 +962,7 @@ class StorageTaskProperties(_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 task_version: Storage task version. :vartype task_version: int @@ -1049,7 +1024,7 @@ class StorageTaskReportInstance(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/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 @@ -1092,41 +1067,40 @@ class StorageTaskReportProperties(_serialization.Model): # pylint: disable=too- Variables are only populated by the server, and will be ignored when sending a request. - :ivar task_assignment_id: Represents the Storage Task Assignment Id associated with the storage - task that provided an execution context. + :ivar task_assignment_id: Resource ID of the Storage Task Assignment associated with this + reported run. :vartype task_assignment_id: str - :ivar storage_account_id: Represents the Storage Account Id where the storage task definition - was applied and executed. + :ivar storage_account_id: Resource ID of the Storage Account where this reported run executed. :vartype storage_account_id: str :ivar start_time: Start time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in - https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. # pylint: disable=line-too-long :vartype start_time: str :ivar finish_time: End time of the run instance. Filter options such as startTime gt '2023-06-26T20:51:24.4494016Z' and other comparison operators can be used as described for DateTime properties in - https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. # pylint: disable=line-too-long :vartype finish_time: str :ivar objects_targeted_count: Total number of objects that meet the condition as defined in the storage task assignment execution context. Filter options such as objectsTargetedCount gt 50 and other comparison operators can be used as described for Numerical properties in - https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. # pylint: disable=line-too-long :vartype objects_targeted_count: str :ivar objects_operated_on_count: Total number of objects that meet the storage tasks condition and were operated upon. Filter options such as objectsOperatedOnCount ge 100 and other comparison operators can be used as described for Numerical properties in - https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. # pylint: disable=line-too-long :vartype objects_operated_on_count: str :ivar object_failed_count: Total number of objects where task operation failed when was attempted. Filter options such as objectFailedCount eq 0 and other comparison operators can be used as described for Numerical properties in - https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. # pylint: disable=line-too-long :vartype object_failed_count: str :ivar objects_succeeded_count: Total number of objects where task operation succeeded when was attempted.Filter options such as objectsSucceededCount gt 150 and other comparison operators can be used as described for Numerical properties in - https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. + https://learn.microsoft.com/en-us/rest/api/storageservices/querying-tables-and-entities#supported-comparison-operators. # pylint: disable=line-too-long :vartype objects_succeeded_count: str :ivar run_status_error: Well known Azure Storage error code that represents the error encountered during execution of the run instance. @@ -1137,7 +1111,7 @@ class StorageTaskReportProperties(_serialization.Model): # pylint: disable=too- :ivar summary_report_path: Full path to the verbose report stored in the reporting container as specified in the assignment execution context for the storage account. :vartype summary_report_path: str - :ivar task_id: Storage Task Arm Id. + :ivar task_id: Resource ID of the Storage Task applied during this run. :vartype task_id: str :ivar task_version: Storage Task Version. :vartype task_version: str @@ -1230,7 +1204,7 @@ def __init__(self, **kwargs: Any) -> None: class StorageTasksListResult(_serialization.Model): - """The response from the List Storage Tasks operation. + """The response from the List Storage Task operation. Variables are only populated by the server, and will be ignored when sending a request. diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_storage_actions_mgmt_client_enums.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_storage_actions_mgmt_client_enums.py index cd74f9195a91..3d38fd05ed69 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_storage_actions_mgmt_client_enums.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/models/_storage_actions_mgmt_client_enums.py @@ -39,11 +39,9 @@ class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class MatchedBlockName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Represents the condition block name that matched blob properties.""" - IF = "If" - ELSE = "Else" - NONE = "None" IF_ENUM = "If" ELSE_ENUM = "Else" + NONE = "None" class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_operations.py index 0ac8f8eb0f21..f96b5fb40aa8 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_operations.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -78,7 +83,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """Lists all of the available Storage Actions Rest API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -89,7 +93,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -100,14 +104,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +122,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationListResult", pipeline_response) @@ -135,11 +138,11 @@ def extract_data(pipeline_response): return 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 +154,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.StorageActions/operations"} diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_task_assignment_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_task_assignment_operations.py index 89d7b73e2162..dd11b3f39397 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_task_assignment_operations.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_task_assignment_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -101,7 +106,7 @@ def __init__(self, *args, **kwargs): def list( self, resource_group_name: str, storage_task_name: str, maxpagesize: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.StorageTaskAssignment"]: - """Lists all the storage tasks available under the given resource group. + """Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. @@ -110,10 +115,9 @@ def list( Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. Required. :type storage_task_name: str - :param maxpagesize: Optional, specifies the maximum number of storage task assignment Ids to be - included in the list response. Default value is None. + :param maxpagesize: Optional, specifies the maximum number of Storage Task Assignment Resource + IDs to be included in the list response. Default value is None. :type maxpagesize: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTaskAssignment or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.models.StorageTaskAssignment] @@ -125,7 +129,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTaskAssignmentsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -136,18 +140,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, maxpagesize=maxpagesize, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -159,13 +162,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("StorageTaskAssignmentsListResult", pipeline_response) @@ -175,11 +178,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -191,7 +194,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments" - } diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_operations.py index e1c5bb318d6e..ac3d29c83218 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_operations.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, cast, overload import urllib.parse from azure.core.exceptions import ( @@ -32,6 +33,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -293,10 +298,10 @@ def _create_initial( self, resource_group_name: str, storage_task_name: str, - parameters: Union[_models.StorageTask, IO], + parameters: Union[_models.StorageTask, IO[bytes]], **kwargs: Any ) -> Optional[_models.StorageTask]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -319,7 +324,7 @@ def _create_initial( else: _json = self._serialize.body(parameters, "StorageTask") - request = build_create_request( + _request = build_create_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, @@ -327,16 +332,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,13 +362,9 @@ def _create_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -394,14 +394,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -413,7 +405,7 @@ def begin_create( self, resource_group_name: str, storage_task_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -432,18 +424,10 @@ def begin_create( letters only. Required. :type storage_task_name: str :param parameters: The parameters to create a Storage Task. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -455,7 +439,7 @@ def begin_create( self, resource_group_name: str, storage_task_name: str, - parameters: Union[_models.StorageTask, IO], + parameters: Union[_models.StorageTask, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.StorageTask]: """Asynchronously creates a new storage task resource with the specified parameters. If a storage @@ -472,19 +456,8 @@ def begin_create( letters only. Required. :type storage_task_name: str :param parameters: The parameters to create a Storage Task. Is either a StorageTask type or a - IO type. Required. - :type parameters: ~azure.mgmt.storageactions.models.StorageTask 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. + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTask or IO[bytes] :return: An instance of LROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -516,7 +489,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("StorageTask", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -528,22 +501,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.StorageTask].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return LROPoller[_models.StorageTask]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, storage_task_name: str, **kwargs: Any ) -> None: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -557,21 +528,20 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) - request = build_delete_request( + _request = build_delete_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -586,11 +556,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, None, response_headers) - - _delete_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return cls(pipeline_response, None, response_headers) # type: ignore @distributed_trace def begin_delete(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) -> LROPoller[None]: @@ -603,14 +569,6 @@ def begin_delete(self, resource_group_name: str, storage_task_name: str, **kwarg Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. Required. :type storage_task_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: @@ -637,7 +595,7 @@ def begin_delete(self, resource_group_name: str, storage_task_name: str, **kwarg 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( @@ -648,17 +606,13 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[None].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_delete.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore @distributed_trace def get(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) -> _models.StorageTask: @@ -671,12 +625,11 @@ def get(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) - Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. Required. :type storage_task_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageTask or the result of cls(response) :rtype: ~azure.mgmt.storageactions.models.StorageTask :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -690,21 +643,20 @@ def get(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTask] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -717,22 +669,18 @@ def get(self, resource_group_name: str, storage_task_name: str, **kwargs: Any) - deserialized = self._deserialize("StorageTask", pipeline_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/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return deserialized # type: ignore def _update_initial( self, resource_group_name: str, storage_task_name: str, - parameters: Union[_models.StorageTaskUpdateParameters, IO], + parameters: Union[_models.StorageTaskUpdateParameters, IO[bytes]], **kwargs: Any ) -> Optional[_models.StorageTask]: - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -755,7 +703,7 @@ def _update_initial( else: _json = self._serialize.body(parameters, "StorageTaskUpdateParameters") - request = build_update_request( + _request = build_update_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, @@ -763,16 +711,15 @@ def _update_initial( content_type=content_type, json=_json, content=_content, - template_url=self._update_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -791,13 +738,9 @@ def _update_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return deserialized # type: ignore @overload def begin_update( @@ -823,14 +766,6 @@ def begin_update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -842,7 +777,7 @@ def begin_update( self, resource_group_name: str, storage_task_name: str, - parameters: IO, + parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -857,18 +792,10 @@ def begin_update( letters only. Required. :type storage_task_name: str :param parameters: The parameters to provide to update the storage task resource. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -880,7 +807,7 @@ def begin_update( self, resource_group_name: str, storage_task_name: str, - parameters: Union[_models.StorageTaskUpdateParameters, IO], + parameters: Union[_models.StorageTaskUpdateParameters, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.StorageTask]: """Update storage task properties. @@ -893,19 +820,8 @@ def begin_update( letters only. Required. :type storage_task_name: str :param parameters: The parameters to provide to update the storage task resource. Is either a - StorageTaskUpdateParameters type or a IO type. Required. - :type parameters: ~azure.mgmt.storageactions.models.StorageTaskUpdateParameters 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. + StorageTaskUpdateParameters type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskUpdateParameters or IO[bytes] :return: An instance of LROPoller that returns either StorageTask or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.storageactions.models.StorageTask] @@ -937,7 +853,7 @@ def begin_update( def get_long_running_output(pipeline_response): deserialized = self._deserialize("StorageTask", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -949,23 +865,20 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.StorageTask].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_update.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}" - } + return LROPoller[_models.StorageTask]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.StorageTask"]: """Lists all the storage tasks available under the subscription. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTask or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.models.StorageTask] :raises ~azure.core.exceptions.HttpResponseError: @@ -976,7 +889,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.StorageTask"] api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTasksListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -987,15 +900,14 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.StorageTask"] def prepare_request(next_link=None): if not next_link: - request = build_list_by_subscription_request( + _request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1007,13 +919,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("StorageTasksListResult", pipeline_response) @@ -1023,11 +935,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1040,10 +952,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_subscription.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks" - } - @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.StorageTask"]: """Lists all the storage tasks available under the given resource group. @@ -1051,7 +959,6 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTask or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.storageactions.models.StorageTask] :raises ~azure.core.exceptions.HttpResponseError: @@ -1062,7 +969,7 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTasksListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1073,16 +980,15 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite def prepare_request(next_link=None): if not next_link: - request = build_list_by_resource_group_request( + _request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -1094,13 +1000,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("StorageTasksListResult", pipeline_response) @@ -1110,11 +1016,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1127,10 +1033,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list_by_resource_group.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks" - } - @overload def preview_actions( self, @@ -1150,7 +1052,6 @@ def preview_actions( :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: StorageTaskPreviewAction or the result of cls(response) :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction :raises ~azure.core.exceptions.HttpResponseError: @@ -1158,7 +1059,7 @@ def preview_actions( @overload def preview_actions( - self, location: str, parameters: IO, *, content_type: str = "application/json", **kwargs: Any + self, location: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.StorageTaskPreviewAction: """Runs the input conditions against input object metadata properties and designates matched objects in response. @@ -1166,11 +1067,10 @@ def preview_actions( :param location: The location to perform preview of the actions. Required. :type location: str :param parameters: The parameters to preview action condition. Required. - :type parameters: IO + :type parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: StorageTaskPreviewAction or the result of cls(response) :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction :raises ~azure.core.exceptions.HttpResponseError: @@ -1178,7 +1078,7 @@ def preview_actions( @distributed_trace def preview_actions( - self, location: str, parameters: Union[_models.StorageTaskPreviewAction, IO], **kwargs: Any + self, location: str, parameters: Union[_models.StorageTaskPreviewAction, IO[bytes]], **kwargs: Any ) -> _models.StorageTaskPreviewAction: """Runs the input conditions against input object metadata properties and designates matched objects in response. @@ -1186,17 +1086,13 @@ def preview_actions( :param location: The location to perform preview of the actions. Required. :type location: str :param parameters: The parameters to preview action condition. Is either a - StorageTaskPreviewAction type or a IO type. Required. - :type parameters: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction 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 + StorageTaskPreviewAction type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction or IO[bytes] :return: StorageTaskPreviewAction or the result of cls(response) :rtype: ~azure.mgmt.storageactions.models.StorageTaskPreviewAction :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -1219,23 +1115,22 @@ def preview_actions( else: _json = self._serialize.body(parameters, "StorageTaskPreviewAction") - request = build_preview_actions_request( + _request = build_preview_actions_request( location=location, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.preview_actions.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1248,10 +1143,6 @@ def preview_actions( deserialized = self._deserialize("StorageTaskPreviewAction", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - preview_actions.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions" - } + return deserialized # type: ignore diff --git a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_report_operations.py b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_report_operations.py index 6b6290a56f0d..c0e22b6787b4 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_report_operations.py +++ b/sdk/storageactions/azure-mgmt-storageactions/azure/mgmt/storageactions/operations/_storage_tasks_report_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar import urllib.parse from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -118,13 +123,12 @@ def list( Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. Required. :type storage_task_name: str - :param maxpagesize: Optional, specifies the maximum number of storage task assignment Ids to be - included in the list response. Default value is None. + :param maxpagesize: Optional, specifies the maximum number of Storage Task Assignment Resource + IDs to be included in the list response. Default value is None. :type maxpagesize: str :param filter: Optional. When specified, it can be used to query using reporting properties. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StorageTaskReportInstance or the result of cls(response) :rtype: @@ -137,7 +141,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.StorageTaskReportSummary] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping[int, Type[HttpResponseError]] = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -148,19 +152,18 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( resource_group_name=resource_group_name, storage_task_name=storage_task_name, subscription_id=self._config.subscription_id, maxpagesize=maxpagesize, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -172,13 +175,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("StorageTaskReportSummary", pipeline_response) @@ -188,11 +191,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -204,7 +207,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports" - } diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/operations_list.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/operations_list.py index d306e73989fc..1ef1f23bc1aa 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/operations_list.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/operations_list.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.storageactions import StorageActionsMgmtClient """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/perform_storage_task_actions_preview.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/perform_storage_task_actions_preview.py index 0e2174026143..676041482c01 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/perform_storage_task_actions_preview.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/misc/perform_storage_task_actions_preview.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.storageactions import StorageActionsMgmtClient """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/delete_storage_task.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/delete_storage_task.py index 7901765c23de..8a3e06e5fb14 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/delete_storage_task.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/delete_storage_task.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.storageactions import StorageActionsMgmtClient """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/get_storage_task.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/get_storage_task.py index ce611430da4e..7389d0676c08 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/get_storage_task.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/get_storage_task.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.storageactions import StorageActionsMgmtClient """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/patch_storage_task.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/patch_storage_task.py index 65ebd43dab95..44eb2f7f67df 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/patch_storage_task.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/patch_storage_task.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.storageactions import StorageActionsMgmtClient """ @@ -33,6 +36,12 @@ def main(): resource_group_name="res4228", storage_task_name="mytask1", parameters={ + "identity": { + "type": "UserAssigned", + "userAssignedIdentities": { + "/subscriptions/1f31ba14-ce16-4281-b9b4-3e78da6e1616/resourceGroups/res4228/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myUserAssignedIdentity": {} + }, + }, "properties": { "action": { "else": {"operations": [{"name": "DeleteBlob", "onFailure": "break", "onSuccess": "continue"}]}, @@ -50,7 +59,7 @@ def main(): }, "description": "My Storage task", "enabled": True, - } + }, }, ).result() print(response) diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/put_storage_task.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/put_storage_task.py index 13bf1632ebf1..ecbacbb88c24 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/put_storage_task.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_crud/put_storage_task.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.storageactions import StorageActionsMgmtClient """ @@ -33,6 +36,7 @@ def main(): resource_group_name="res4228", storage_task_name="mytask1", parameters={ + "identity": {"type": "SystemAssigned"}, "location": "westus", "properties": { "action": { diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_task_assignment_ids.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_task_assignment_ids.py index d7f24735f2b6..d35a03e40042 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_task_assignment_ids.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_task_assignment_ids.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.storageactions import StorageActionsMgmtClient """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_resource_group.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_resource_group.py index 368149b7c421..2c909edd983f 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_resource_group.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_resource_group.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.storageactions import StorageActionsMgmtClient """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_subscription.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_subscription.py index 83d2312d83fa..515e06af5edb 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_subscription.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_by_subscription.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.storageactions import StorageActionsMgmtClient """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_run_report_summary.py b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_run_report_summary.py index 2f1fbc4a7b52..16d6999e0028 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_run_report_summary.py +++ b/sdk/storageactions/azure-mgmt-storageactions/generated_samples/storage_tasks_list/list_storage_tasks_run_report_summary.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.storageactions import StorageActionsMgmtClient """ diff --git a/sdk/storageactions/azure-mgmt-storageactions/setup.py b/sdk/storageactions/azure-mgmt-storageactions/setup.py index 37bba30f0185..669ea08da88a 100644 --- a/sdk/storageactions/azure-mgmt-storageactions/setup.py +++ b/sdk/storageactions/azure-mgmt-storageactions/setup.py @@ -74,9 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], python_requires=">=3.8", )