diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json index 2ded8c5014c7..1cda0773bb70 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json @@ -1,11 +1,11 @@ { + "commit": "e6255e7ac100b87a85a9a98adcd4e6250c1a1e76", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.1.11", + "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "commit": "63d73ac003b6435c5acae75cb2e81c2aac5e2ddc", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.11 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/recoveryservicesbackup/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.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/recoveryservicesbackup/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py index 15cfc033acec..4365d800f0cd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["RecoveryServicesBackupClient"] +__all__ = [ + "RecoveryServicesBackupClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py index 00b7712b2c53..e7b8fb86c8fb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +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 azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class RecoveryServicesBackupClientConfiguration(Configuration): # pylint: disab def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesBackupClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop("api_version", "2022-09-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicesbackup/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py index ccef3ed973e2..7fc11ae4a026 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import RecoveryServicesBackupClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -253,7 +253,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -399,15 +399,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> RecoveryServicesBackupClient + def __enter__(self) -> "RecoveryServicesBackupClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py index 7c1dedb5133d..2c170e28dbca 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,24 +38,22 @@ import re import sys import codecs +from typing import Optional, Union, AnyStr, IO, Mapping try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING +from typing import Dict, Any, cast from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - class RawDeserializer: @@ -65,8 +64,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +130,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +157,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +185,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +216,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,9 +273,9 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs): self.additional_properties = {} @@ -310,7 +307,7 @@ def enable_additional_properties_sending(cls): @classmethod def is_xml_model(cls): try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,7 +316,7 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} @@ -453,7 +450,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -606,13 +603,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +618,23 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore 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) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): + for k in reversed(keys): # type: ignore unflattened = {k: new_attr} new_attr = unflattened _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -675,7 +672,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -843,7 +840,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +998,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1416,7 +1413,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1441,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1543,7 +1540,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1562,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1744,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1795,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1807,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1823,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1838,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1868,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + 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) @@ -1886,7 +1883,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1898,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1921,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1957,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py index 378b64967444..0cfd60ba6dc4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_vendor.py @@ -38,7 +38,7 @@ def _format_url_section(template, **kwargs): template = "/".join(components) -class MixinABC(ABC): +class RecoveryServicesBackupClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "PipelineClient" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py index 96ddf058f512..e5754a47ce68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.1.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py index cff2a6c66af2..8e5f383e6ee4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["RecoveryServicesBackupClient"] +__all__ = [ + "RecoveryServicesBackupClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py index af13eb36d1fd..470122c3bfec 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +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 azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class RecoveryServicesBackupClientConfiguration(Configuration): # pylint: disab def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesBackupClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop("api_version", "2022-09-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py index 304fb0044a71..9c8d5c76833e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import RecoveryServicesBackupClientConfiguration from .operations import ( @@ -255,7 +255,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py index f398622a7581..1da41c8befcd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_vendor.py @@ -19,7 +19,7 @@ from .._serialization import Deserializer, Serializer -class MixinABC(ABC): +class RecoveryServicesBackupClientMixinABC(ABC): """DO NOT use this class. It is for internal typing use only.""" _client: "AsyncPipelineClient" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py index 619214e67304..2fd9d9f59b4b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/__init__.py @@ -60,7 +60,7 @@ from ._resource_guard_proxy_operations import ResourceGuardProxyOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py index 388658cbb85f..d9cca4ddec13 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -29,8 +30,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_engines_operations import build_get_request, build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupEngineBaseResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupEngineBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +118,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -127,7 +134,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,13 +142,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupEngineBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,7 +161,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines" + } @distributed_trace_async async def get( @@ -195,8 +204,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupEngineBaseResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupEngineBaseResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -211,9 +222,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -230,4 +241,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py index a7de1f6d2e09..05d1942d5f77 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_jobs_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +115,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +131,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +139,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -151,4 +158,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py index 2890668e1029..d47e77b95ba0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_operation_results_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,8 +91,10 @@ async def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -100,9 +107,9 @@ async def get( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -115,4 +122,6 @@ async def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py index 497f75a2f490..a191239ada51 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_operation_statuses_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -84,8 +89,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -98,9 +105,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -117,4 +124,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py index 2bc517962e6c..7263becec630 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_policies_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionPolicyResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,7 +110,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -119,7 +126,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProtectionPolicyResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -146,4 +153,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py index edb2fa1febc0..81090ca63777 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protectable_items_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkloadProtectableItemResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.WorkloadProtectableItemResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -111,7 +118,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -127,7 +134,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -135,13 +142,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("WorkloadProtectableItemResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -154,4 +161,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py index 76aaaeabc53d..7f8bfd5522e3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protected_items_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectedItemResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +116,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +132,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +140,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProtectedItemResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -152,4 +159,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py index d597a030408e..24b0d9930aa0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protection_containers_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,8 +81,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionContainerResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -117,7 +124,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +132,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProtectionContainerResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,4 +151,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py index 78b436b7757b..b6df5a734a84 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_protection_intent_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionIntentResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +116,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +132,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +140,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProtectionIntentResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -152,4 +159,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents"} # type: ignore + list.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py index 53bf41e12b8c..84b73a876426 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_resource_encryption_configs_operations import build_get_request, build_update_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -79,8 +84,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceEncryptionConfigExtendedResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupResourceEncryptionConfigExtendedResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -92,9 +99,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -112,7 +119,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig" + } @overload async def update( # pylint: disable=inconsistent-return-statements @@ -210,9 +219,11 @@ async def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -235,9 +246,9 @@ async def update( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -251,4 +262,6 @@ async def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py index 1d7b30198fbd..9380bf0cb524 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -30,8 +31,12 @@ build_patch_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupResourceConfigResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -95,9 +102,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -115,7 +122,9 @@ async def get( return deserialized - get.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + get.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } @overload async def update( @@ -211,9 +220,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupResourceConfigResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -236,9 +247,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -256,7 +267,9 @@ async def update( return deserialized - update.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + update.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } @overload async def patch( # pylint: disable=inconsistent-return-statements @@ -352,9 +365,11 @@ async def patch( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -377,9 +392,9 @@ async def patch( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -393,4 +408,6 @@ async def patch( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - patch.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + patch.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py index 7607449617de..ecf945b70441 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -30,8 +31,12 @@ build_put_request, build_update_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupResourceVaultConfigResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -95,9 +102,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -115,7 +122,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" + } @overload async def update( @@ -211,9 +220,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupResourceVaultConfigResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -236,9 +247,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -256,7 +267,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" + } @overload async def put( @@ -352,9 +365,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupResourceVaultConfigResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -377,9 +392,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -397,4 +412,6 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py index 36f43943eab6..31dc8d5bcd2b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_status_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -131,9 +136,11 @@ async def get( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStatusResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupStatusResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -155,9 +162,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -174,4 +181,6 @@ async def get( return deserialized - get.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus"} # type: ignore + get.metadata = { + "url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py index 7199090b351c..cfe92424a78a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_usage_summaries_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupManagementUsageList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupManagementUsageList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +116,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +132,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +140,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupManagementUsageList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -152,4 +159,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore + list.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py index a45b72f0d787..01f6c957a8dd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backup_workload_items_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -91,8 +96,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkloadItemResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.WorkloadItemResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -119,7 +126,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -135,7 +142,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -143,13 +150,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("WorkloadItemResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -162,4 +169,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py index 29aa93dfbb5d..3ba3022c7f66 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._backups_operations import build_trigger_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -177,9 +182,11 @@ async def trigger( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -205,9 +212,9 @@ async def trigger( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -220,4 +227,6 @@ async def trigger( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup"} # type: ignore + trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py index 776d77218b2a..fc794e12c84d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._bms_prepare_data_move_operation_result_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.VaultStorageConfigOperationResultResponse]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.VaultStorageConfigOperationResultResponse]] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -96,9 +103,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -118,4 +125,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py index d7615cd4e478..ad0e50472a17 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_deleted_protection_containers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._deleted_protection_containers_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,8 +81,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionContainerResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -101,7 +108,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -117,7 +124,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -125,13 +132,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProtectionContainerResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -144,4 +151,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py index 745270ef522a..e556fea16eab 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._export_jobs_operation_results_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultInfoBaseResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationResultInfoBaseResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -97,9 +104,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -116,8 +123,10 @@ async def get( deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py index e50e7bc3a5e3..d32be69348fa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._feature_support_operations import build_validate_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -134,9 +139,11 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AzureVMResourceFeatureSupportResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureVMResourceFeatureSupportResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -158,9 +165,9 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -177,4 +184,6 @@ async def validate( return deserialized - validate.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures"} # type: ignore + validate.metadata = { + "url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py index a5e019ed35a9..33bbcbf7e875 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._item_level_recovery_connections_operations import build_provision_request, build_revoke_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -201,9 +206,11 @@ async def provision( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -230,9 +237,9 @@ async def provision( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -245,7 +252,9 @@ async def provision( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - provision.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery"} # type: ignore + provision.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery" + } @distributed_trace_async async def revoke( # pylint: disable=inconsistent-return-statements @@ -294,8 +303,10 @@ async def revoke( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_revoke_request( vault_name=vault_name, @@ -311,9 +322,9 @@ async def revoke( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -326,4 +337,6 @@ async def revoke( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revoke.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery"} # type: ignore + revoke.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py index 5ea2830134e0..0eb647fe55a1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._job_cancellations_operations import build_trigger_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +86,10 @@ async def trigger( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_trigger_request( vault_name=vault_name, @@ -95,9 +102,9 @@ async def trigger( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -110,4 +117,6 @@ async def trigger( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel"} # type: ignore + trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py index 492fa260b9c1..cd4149f09151 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._job_details_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ async def get(self, vault_name: str, resource_group_name: str, job_name: str, ** _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -92,9 +99,9 @@ async def get(self, vault_name: str, resource_group_name: str, job_name: str, ** params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,4 +118,6 @@ async def get(self, vault_name: str, resource_group_name: str, job_name: str, ** return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py index e102924db5f7..658dbc4f45f4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._job_operation_results_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ async def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -98,9 +105,9 @@ async def get( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -113,4 +120,6 @@ async def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py index c71ad10defaf..bd06fa1b2aa3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._jobs_operations import build_export_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -80,8 +85,10 @@ async def export( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_export_request( vault_name=vault_name, @@ -94,9 +101,9 @@ async def export( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -109,4 +116,6 @@ async def export( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - export.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport"} # type: ignore + export.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py index 33b20f678bea..6f01d0e4ee51 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operation_operations import build_validate_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -146,9 +151,11 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateOperationsResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateOperationsResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -171,9 +178,9 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -190,4 +197,6 @@ async def validate( return deserialized - validate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation"} # type: ignore + validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py index 4270ce31ad23..46c6778b80fc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -67,8 +72,10 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.ClientDiscoveryValueForS _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientDiscoveryResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -88,7 +95,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -104,7 +111,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -112,13 +119,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ClientDiscoveryResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -131,4 +138,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.RecoveryServices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.RecoveryServices/operations"} diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py index 6a9aad65151c..0440ff2f821f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -32,8 +33,12 @@ build_get_request, build_put_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -86,8 +91,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -100,9 +107,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -120,7 +127,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _put_initial( self, @@ -141,9 +150,11 @@ async def _put_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -167,9 +178,9 @@ async def _put_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -186,11 +197,13 @@ async def _put_initial( deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _put_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload async def begin_put( @@ -314,14 +327,16 @@ async def begin_put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = await self._put_initial( # type: ignore + raw_result = await self._put_initial( vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -342,7 +357,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -354,9 +369,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -372,8 +389,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -386,9 +405,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -401,7 +420,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace_async async def begin_delete( @@ -431,11 +452,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore vault_name=vault_name, @@ -454,7 +477,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -466,6 +489,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py index 1da8d9751673..79c21de141c7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._private_endpoint_operations import build_get_operation_status_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -89,8 +94,10 @@ async def get_operation_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_operation_status_request( vault_name=vault_name, @@ -104,9 +111,9 @@ async def get_operation_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -124,4 +131,6 @@ async def get_operation_status( return deserialized - get_operation_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}"} # type: ignore + get_operation_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py index b3f168ca6c97..69acbb1d4a25 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._protectable_containers_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectableContainerResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectableContainerResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,7 +111,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -120,7 +127,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -128,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProtectableContainerResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -147,4 +154,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py index 8bb9880dbe45..c71b30df2316 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._protected_item_operation_results_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -94,8 +99,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectedItemResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.ProtectedItemResource]] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -111,9 +118,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -132,4 +139,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py index 0238fe885d44..5260b459a90d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._protected_item_operation_statuses_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,8 +103,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -115,9 +122,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -134,4 +141,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py index 33e49ba18fab..07100ff74206 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -30,8 +31,12 @@ build_delete_request, build_get_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,8 +104,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectedItemResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -116,9 +123,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -135,7 +142,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" + } @overload async def create_or_update( @@ -266,9 +275,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectedItemResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ProtectedItemResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -294,9 +305,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,7 +326,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -358,8 +371,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -374,9 +389,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -389,4 +404,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py index e9de72f28655..f487c060a3a8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._protection_container_operation_results_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -92,8 +97,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionContainerResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.ProtectionContainerResource]] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -108,9 +115,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -129,4 +136,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py index ed2d828e8514..32adc3c92657 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._protection_container_refresh_operation_results_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ async def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -98,9 +105,9 @@ async def get( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -113,4 +120,6 @@ async def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py index 464a5a2a879b..566b41a51f53 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -32,8 +33,12 @@ build_register_request, build_unregister_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,8 +93,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionContainerResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -103,9 +110,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -122,7 +129,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" + } @overload async def register( @@ -248,9 +257,11 @@ async def register( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionContainerResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ProtectionContainerResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -275,9 +286,9 @@ async def register( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -296,7 +307,9 @@ async def register( return deserialized - register.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + register.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" + } @distributed_trace_async async def unregister( # pylint: disable=inconsistent-return-statements @@ -333,8 +346,10 @@ async def unregister( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_unregister_request( vault_name=vault_name, @@ -348,9 +363,9 @@ async def unregister( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -363,7 +378,9 @@ async def unregister( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - unregister.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + unregister.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" + } @distributed_trace_async async def inquire( # pylint: disable=inconsistent-return-statements @@ -407,8 +424,10 @@ async def inquire( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_inquire_request( vault_name=vault_name, @@ -423,9 +442,9 @@ async def inquire( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -438,7 +457,9 @@ async def inquire( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - inquire.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire"} # type: ignore + inquire.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire" + } @distributed_trace_async async def refresh( # pylint: disable=inconsistent-return-statements @@ -474,8 +495,10 @@ async def refresh( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( vault_name=vault_name, @@ -489,9 +512,9 @@ async def refresh( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -504,4 +527,6 @@ async def refresh( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - refresh.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers"} # type: ignore + refresh.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py index 5dc1700fa642..891c709294eb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,8 +32,12 @@ build_get_request, build_validate_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -167,9 +172,11 @@ async def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PreValidateEnableBackupResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PreValidateEnableBackupResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -191,9 +198,9 @@ async def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,7 +217,9 @@ async def validate( return deserialized - validate.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection"} # type: ignore + validate.metadata = { + "url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection" + } @distributed_trace_async async def get( @@ -245,8 +254,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionIntentResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -260,9 +271,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -279,7 +290,9 @@ async def get( return deserialized - get.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + get.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" + } @overload async def create_or_update( @@ -393,9 +406,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProtectionIntentResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -420,9 +435,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -439,7 +454,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + create_or_update.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -472,8 +489,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -487,9 +506,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -502,4 +521,6 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + delete.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py index 381c9a368c43..a433a1f356eb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -32,8 +33,12 @@ build_delete_request, build_get_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,8 +93,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionPolicyResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -102,9 +109,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -121,7 +128,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" + } @overload async def create_or_update( @@ -232,9 +241,11 @@ async def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionPolicyResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ProtectionPolicyResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -258,9 +269,9 @@ async def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -279,7 +290,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, policy_name: str, **kwargs: Any @@ -295,8 +308,10 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -309,9 +324,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -324,7 +339,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" + } @distributed_trace_async async def begin_delete( @@ -356,11 +373,13 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore vault_name=vault_name, @@ -379,7 +398,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -391,6 +410,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py index 1425b1cc1cf0..dbc6ea38c983 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._protection_policy_operation_results_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,8 +88,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionPolicyResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -98,9 +105,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -117,4 +124,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py index ecfe384c3a4b..644b6a51794d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._protection_policy_operation_statuses_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -87,8 +92,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -102,9 +109,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -121,4 +128,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py index 9826a03cefcd..182f233dba22 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -29,8 +30,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._recovery_points_operations import build_get_request, build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -90,8 +95,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -118,7 +125,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -134,7 +141,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -142,13 +149,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RecoveryPointResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -161,7 +168,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints" + } @distributed_trace_async async def get( @@ -209,8 +218,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RecoveryPointResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -226,9 +237,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -245,4 +256,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py index 1dc3c7ea6ccf..b108fbaa33c1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._recovery_points_recommended_for_move_operations import build_list_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -174,9 +179,11 @@ def list( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -212,7 +219,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -228,7 +235,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -236,13 +243,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RecoveryPointResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -255,4 +262,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py index 7d3233566fea..c93765ebac2f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -33,13 +34,17 @@ build_get_operation_status_request, build_move_recovery_point_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -class RecoveryServicesBackupClientOperationsMixin(MixinABC): +class RecoveryServicesBackupClientOperationsMixin(RecoveryServicesBackupClientMixinABC): @distributed_trace_async async def get_operation_status( self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any @@ -69,8 +74,10 @@ async def get_operation_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_operation_status_request( vault_name=vault_name, @@ -83,9 +90,9 @@ async def get_operation_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -103,7 +110,9 @@ async def get_operation_status( return deserialized - get_operation_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}"} # type: ignore + get_operation_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}" + } async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements self, @@ -123,9 +132,11 @@ async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -148,9 +159,9 @@ async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -164,7 +175,9 @@ async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _bms_prepare_data_move_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + _bms_prepare_data_move_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove" + } @overload async def begin_bms_prepare_data_move( @@ -272,12 +285,14 @@ async def begin_bms_prepare_data_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._bms_prepare_data_move_initial( # type: ignore vault_name=vault_name, @@ -297,7 +312,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -309,9 +324,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_bms_prepare_data_move.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + begin_bms_prepare_data_move.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove" + } async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements self, @@ -331,9 +348,11 @@ async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -356,9 +375,9 @@ async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -372,7 +391,9 @@ async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return if cls: return cls(pipeline_response, None, {}) - _bms_trigger_data_move_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + _bms_trigger_data_move_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove" + } @overload async def begin_bms_trigger_data_move( @@ -480,12 +501,14 @@ async def begin_bms_trigger_data_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._bms_trigger_data_move_initial( # type: ignore vault_name=vault_name, @@ -505,7 +528,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -517,9 +540,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_bms_trigger_data_move.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + begin_bms_trigger_data_move.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove" + } async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements self, @@ -543,9 +568,11 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -572,9 +599,9 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -587,7 +614,9 @@ async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-s if cls: return cls(pipeline_response, None, {}) - _move_recovery_point_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + _move_recovery_point_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move" + } @overload async def begin_move_recovery_point( @@ -739,12 +768,14 @@ async def begin_move_recovery_point( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._move_recovery_point_initial( # type: ignore vault_name=vault_name, @@ -768,7 +799,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -780,6 +811,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_move_recovery_point.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + begin_move_recovery_point.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py index 83a3654f286f..a95fd75a4280 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._resource_guard_proxies_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,8 +79,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,7 +105,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -114,7 +121,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -122,13 +129,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceGuardProxyBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -141,4 +148,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py index 2a7e2257faf7..f07164086502 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,8 +32,12 @@ build_put_request, build_unlock_delete_request, ) -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -99,9 +106,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -118,7 +125,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } @overload async def put( @@ -226,9 +235,11 @@ async def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -252,9 +263,9 @@ async def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -271,7 +282,9 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -302,8 +315,10 @@ async def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -316,9 +331,9 @@ async def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -331,7 +346,9 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } @overload async def unlock_delete( @@ -435,9 +452,11 @@ async def unlock_delete( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UnlockDeleteResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UnlockDeleteResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -461,9 +480,9 @@ async def unlock_delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -480,4 +499,6 @@ async def unlock_delete( return deserialized - unlock_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore + unlock_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py index 9d6885219b10..3e08bf3107d5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._restores_operations import build_trigger_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,9 +80,11 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -104,9 +111,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -119,7 +126,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + _trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore" + } @overload async def begin_trigger( @@ -272,12 +281,14 @@ async def begin_trigger( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._trigger_initial( # type: ignore vault_name=vault_name, @@ -301,7 +312,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -313,6 +324,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + begin_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py index 1f8f597d6f8d..632315c661b8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._security_pins_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -144,9 +149,11 @@ async def get( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TokenInformation] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TokenInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -172,9 +179,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -191,4 +198,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py index e5cac4307490..a8fc2c2005f9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -28,8 +29,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._validate_operation_operations import build_trigger_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -71,9 +76,11 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -96,9 +103,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,7 +118,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + _trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation" + } @overload async def begin_trigger( @@ -224,12 +233,14 @@ async def begin_trigger( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._trigger_initial( # type: ignore vault_name=vault_name, @@ -249,7 +260,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) # type: AsyncPollingMethod + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -261,6 +272,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + begin_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py index fd6f870286c1..40c71b1fe99a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._validate_operation_results_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ValidateOperationsResponse]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.ValidateOperationsResponse]] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -96,9 +103,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -117,4 +124,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py index 83d352317c7e..1d1c60535b70 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -26,8 +27,12 @@ from ... import models as _models from ..._vendor import _convert_request from ...operations._validate_operation_statuses_operations import build_get_request -from .._vendor import MixinABC +from .._vendor import RecoveryServicesBackupClientMixinABC +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,8 +90,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -99,9 +106,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -118,4 +125,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py index 35ce2a2fac75..402b500090fb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py @@ -370,7 +370,7 @@ from ._recovery_services_backup_client_enums import WorkloadType from ._recovery_services_backup_client_enums import XcoolState from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py index a50b57daef0b..31e64e8e0d43 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py @@ -47,7 +47,7 @@ class FeatureSupportRequest(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.feature_type = None # type: Optional[str] + self.feature_type: Optional[str] = None class AzureBackupGoalFeatureSupportRequest(FeatureSupportRequest): @@ -70,7 +70,7 @@ class AzureBackupGoalFeatureSupportRequest(FeatureSupportRequest): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.feature_type = "AzureBackupGoals" # type: str + self.feature_type: str = "AzureBackupGoals" class ProtectionContainer(_serialization.Model): @@ -169,7 +169,7 @@ def __init__( self.backup_management_type = backup_management_type self.registration_status = registration_status self.health_status = health_status - self.container_type = None # type: Optional[str] + self.container_type: Optional[str] = None self.protectable_object_type = protectable_object_type @@ -311,7 +311,7 @@ def __init__( protectable_object_type=protectable_object_type, **kwargs ) - self.container_type = "DPMContainer" # type: str + self.container_type: str = "DPMContainer" self.can_re_register = can_re_register self.container_id = container_id self.protected_item_count = protected_item_count @@ -463,7 +463,7 @@ def __init__( extended_info=extended_info, **kwargs ) - self.container_type = "AzureBackupServerContainer" # type: str + self.container_type: str = "AzureBackupServerContainer" class BackupEngineBase(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -594,7 +594,7 @@ def __init__( self.registration_status = registration_status self.backup_engine_state = backup_engine_state self.health_status = health_status - self.backup_engine_type = None # type: Optional[str] + self.backup_engine_type: Optional[str] = None self.can_re_register = can_re_register self.backup_engine_id = backup_engine_id self.dpm_version = dpm_version @@ -731,7 +731,7 @@ def __init__( extended_info=extended_info, **kwargs ) - self.backup_engine_type = "AzureBackupServerEngine" # type: str + self.backup_engine_type: str = "AzureBackupServerEngine" class BackupRequest(_serialization.Model): @@ -766,7 +766,7 @@ class BackupRequest(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureFileShareBackupRequest(BackupRequest): @@ -798,7 +798,7 @@ def __init__(self, *, recovery_point_expiry_time_in_utc: Optional[datetime.datet :paramtype recovery_point_expiry_time_in_utc: ~datetime.datetime """ super().__init__(**kwargs) - self.object_type = "AzureFileShareBackupRequest" # type: str + self.object_type: str = "AzureFileShareBackupRequest" self.recovery_point_expiry_time_in_utc = recovery_point_expiry_time_in_utc @@ -868,7 +868,7 @@ def __init__( super().__init__(**kwargs) self.backup_management_type = backup_management_type self.workload_type = workload_type - self.protectable_item_type = None # type: Optional[str] + self.protectable_item_type: Optional[str] = None self.friendly_name = friendly_name self.protection_state = protection_state @@ -958,7 +958,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.protectable_item_type = "AzureFileShare" # type: str + self.protectable_item_type: str = "AzureFileShare" self.parent_container_fabric_id = parent_container_fabric_id self.parent_container_friendly_name = parent_container_friendly_name self.azure_file_share_type = azure_file_share_type @@ -1125,7 +1125,7 @@ def __init__( :paramtype soft_delete_retention_period: int """ super().__init__(**kwargs) - self.protected_item_type = None # type: Optional[str] + self.protected_item_type: Optional[str] = None self.backup_management_type = None self.workload_type = None self.container_name = container_name @@ -1357,7 +1357,7 @@ def __init__( # pylint: disable=too-many-locals soft_delete_retention_period=soft_delete_retention_period, **kwargs ) - self.protected_item_type = "AzureFileShareProtectedItem" # type: str + self.protected_item_type: str = "AzureFileShareProtectedItem" self.friendly_name = friendly_name self.protection_status = protection_status self.protection_state = protection_state @@ -1479,7 +1479,7 @@ def __init__( """ super().__init__(**kwargs) self.protected_items_count = protected_items_count - self.backup_management_type = None # type: Optional[str] + self.backup_management_type: Optional[str] = None self.resource_guard_operation_requests = resource_guard_operation_requests @@ -1562,7 +1562,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.backup_management_type = "AzureStorage" # type: str + self.backup_management_type: str = "AzureStorage" self.work_load_type = work_load_type self.schedule_policy = schedule_policy self.retention_policy = retention_policy @@ -1600,7 +1600,7 @@ class ILRRequest(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureFileShareProvisionILRRequest(ILRRequest): @@ -1635,7 +1635,7 @@ def __init__(self, *, recovery_point_id: Optional[str] = None, source_resource_i :paramtype source_resource_id: str """ super().__init__(**kwargs) - self.object_type = "AzureFileShareProvisionILRRequest" # type: str + self.object_type: str = "AzureFileShareProvisionILRRequest" self.recovery_point_id = recovery_point_id self.source_resource_id = source_resource_id @@ -1674,7 +1674,7 @@ class RecoveryPoint(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureFileShareRecoveryPoint(RecoveryPoint): @@ -1729,7 +1729,7 @@ def __init__( :paramtype recovery_point_size_in_gb: int """ super().__init__(**kwargs) - self.object_type = "AzureFileShareRecoveryPoint" # type: str + self.object_type: str = "AzureFileShareRecoveryPoint" self.recovery_point_type = recovery_point_type self.recovery_point_time = recovery_point_time self.file_share_snapshot_uri = file_share_snapshot_uri @@ -1768,7 +1768,7 @@ class RestoreRequest(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureFileShareRestoreRequest(RestoreRequest): @@ -1850,7 +1850,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.TargetAFSRestoreInfo """ super().__init__(**kwargs) - self.object_type = "AzureFileShareRestoreRequest" # type: str + self.object_type: str = "AzureFileShareRestoreRequest" self.recovery_type = recovery_type self.source_resource_id = source_resource_id self.copy_options = copy_options @@ -1974,7 +1974,7 @@ def __init__( protectable_object_type=protectable_object_type, **kwargs ) - self.container_type = "IaasVMContainer" # type: str + self.container_type: str = "IaasVMContainer" self.virtual_machine_id = virtual_machine_id self.virtual_machine_version = virtual_machine_version self.resource_group = resource_group @@ -2088,7 +2088,7 @@ def __init__( resource_group=resource_group, **kwargs ) - self.container_type = "Microsoft.ClassicCompute/virtualMachines" # type: str + self.container_type: str = "Microsoft.ClassicCompute/virtualMachines" class IaaSVMProtectableItem(WorkloadProtectableItem): @@ -2180,7 +2180,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.protectable_item_type = "IaaSVMProtectableItem" # type: str + self.protectable_item_type: str = "IaaSVMProtectableItem" self.virtual_machine_id = virtual_machine_id self.virtual_machine_version = virtual_machine_version self.resource_group = resource_group @@ -2268,7 +2268,7 @@ def __init__( resource_group=resource_group, **kwargs ) - self.protectable_item_type = "Microsoft.ClassicCompute/virtualMachines" # type: str + self.protectable_item_type: str = "Microsoft.ClassicCompute/virtualMachines" class AzureIaaSVMProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes @@ -2520,7 +2520,7 @@ def __init__( # pylint: disable=too-many-locals soft_delete_retention_period=soft_delete_retention_period, **kwargs ) - self.protected_item_type = "AzureIaaSVMProtectedItem" # type: str + self.protected_item_type: str = "AzureIaaSVMProtectedItem" self.friendly_name = None self.virtual_machine_id = None self.protection_status = protection_status @@ -2781,7 +2781,7 @@ def __init__( # pylint: disable=too-many-locals extended_properties=extended_properties, **kwargs ) - self.protected_item_type = "Microsoft.ClassicCompute/virtualMachines" # type: str + self.protected_item_type: str = "Microsoft.ClassicCompute/virtualMachines" class AzureIaaSComputeVMContainer(IaaSVMContainer): @@ -2892,7 +2892,7 @@ def __init__( resource_group=resource_group, **kwargs ) - self.container_type = "Microsoft.Compute/virtualMachines" # type: str + self.container_type: str = "Microsoft.Compute/virtualMachines" class AzureIaaSComputeVMProtectableItem(IaaSVMProtectableItem): @@ -2977,7 +2977,7 @@ def __init__( resource_group=resource_group, **kwargs ) - self.protectable_item_type = "Microsoft.Compute/virtualMachines" # type: str + self.protectable_item_type: str = "Microsoft.Compute/virtualMachines" class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes @@ -3226,7 +3226,7 @@ def __init__( # pylint: disable=too-many-locals extended_properties=extended_properties, **kwargs ) - self.protected_item_type = "Microsoft.Compute/virtualMachines" # type: str + self.protected_item_type: str = "Microsoft.Compute/virtualMachines" class AzureIaaSVMErrorInfo(_serialization.Model): @@ -3436,7 +3436,7 @@ def __init__( self.start_time = start_time self.end_time = end_time self.activity_id = activity_id - self.job_type = None # type: Optional[str] + self.job_type: Optional[str] = None class AzureIaaSVMJob(Job): # pylint: disable=too-many-instance-attributes @@ -3573,7 +3573,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "AzureIaaSVMJob" # type: str + self.job_type: str = "AzureIaaSVMJob" self.duration = duration self.actions_info = actions_info self.error_details = error_details @@ -3851,7 +3851,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "AzureIaaSVMJobV2" # type: str + self.job_type: str = "AzureIaaSVMJobV2" self.actions_info = actions_info self.container_name = container_name self.duration = duration @@ -4029,7 +4029,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.backup_management_type = "AzureIaasVM" # type: str + self.backup_management_type: str = "AzureIaasVM" self.instant_rp_details = instant_rp_details self.schedule_policy = schedule_policy self.retention_policy = retention_policy @@ -4122,7 +4122,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionStatus """ super().__init__(**kwargs) - self.protection_intent_item_type = None # type: Optional[str] + self.protection_intent_item_type: Optional[str] = None self.backup_management_type = backup_management_type self.source_resource_id = source_resource_id self.item_id = item_id @@ -4215,7 +4215,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.protection_intent_item_type = "RecoveryServiceVaultItem" # type: str + self.protection_intent_item_type: str = "RecoveryServiceVaultItem" class AzureResourceProtectionIntent(ProtectionIntent): @@ -4302,7 +4302,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.protection_intent_item_type = "AzureResourceItem" # type: str + self.protection_intent_item_type: str = "AzureResourceItem" self.friendly_name = friendly_name @@ -4445,7 +4445,7 @@ def __init__( protectable_object_type=protectable_object_type, **kwargs ) - self.container_type = "AzureWorkloadContainer" # type: str + self.container_type: str = "AzureWorkloadContainer" self.source_resource_id = source_resource_id self.last_updated_time = last_updated_time self.extended_info = extended_info @@ -4589,7 +4589,7 @@ def __init__( operation_type=operation_type, **kwargs ) - self.container_type = "SQLAGWorkLoadContainer" # type: str + self.container_type: str = "SQLAGWorkLoadContainer" class AzureSqlContainer(ProtectionContainer): @@ -4675,7 +4675,7 @@ def __init__( protectable_object_type=protectable_object_type, **kwargs ) - self.container_type = "AzureSqlContainer" # type: str + self.container_type: str = "AzureSqlContainer" class AzureSqlProtectedItem(ProtectedItem): # pylint: disable=too-many-instance-attributes @@ -4866,7 +4866,7 @@ def __init__( soft_delete_retention_period=soft_delete_retention_period, **kwargs ) - self.protected_item_type = "Microsoft.Sql/servers/databases" # type: str + self.protected_item_type: str = "Microsoft.Sql/servers/databases" self.protected_item_data_id = protected_item_data_id self.protection_state = protection_state self.extended_info = extended_info @@ -4962,7 +4962,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.backup_management_type = "AzureSql" # type: str + self.backup_management_type: str = "AzureSql" self.retention_policy = retention_policy @@ -5083,7 +5083,7 @@ def __init__( protectable_object_type=protectable_object_type, **kwargs ) - self.container_type = "StorageContainer" # type: str + self.container_type: str = "StorageContainer" self.source_resource_id = source_resource_id self.storage_account_version = storage_account_version self.resource_group = resource_group @@ -5264,7 +5264,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "AzureStorageJob" # type: str + self.job_type: str = "AzureStorageJob" self.duration = duration self.actions_info = actions_info self.error_details = error_details @@ -5418,7 +5418,7 @@ def __init__( super().__init__(**kwargs) self.friendly_name = friendly_name self.backup_management_type = backup_management_type - self.protectable_container_type = None # type: Optional[str] + self.protectable_container_type: Optional[str] = None self.health_status = health_status self.container_id = container_id @@ -5494,7 +5494,7 @@ def __init__( container_id=container_id, **kwargs ) - self.protectable_container_type = "StorageContainer" # type: str + self.protectable_container_type: str = "StorageContainer" class AzureVMAppContainerProtectableContainer(ProtectableContainer): @@ -5568,7 +5568,7 @@ def __init__( container_id=container_id, **kwargs ) - self.protectable_container_type = "VMAppContainer" # type: str + self.protectable_container_type: str = "VMAppContainer" class AzureVMAppContainerProtectionContainer(AzureWorkloadContainer): # pylint: disable=too-many-instance-attributes @@ -5705,7 +5705,7 @@ def __init__( operation_type=operation_type, **kwargs ) - self.container_type = "VMAppContainer" # type: str + self.container_type: str = "VMAppContainer" class AzureVMResourceFeatureSupportRequest(FeatureSupportRequest): @@ -5739,7 +5739,7 @@ def __init__(self, *, vm_size: Optional[str] = None, vm_sku: Optional[str] = Non :paramtype vm_sku: str """ super().__init__(**kwargs) - self.feature_type = "AzureVMResourceBackup" # type: str + self.feature_type: str = "AzureVMResourceBackup" self.vm_size = vm_size self.vm_sku = vm_sku @@ -5828,7 +5828,7 @@ def __init__( super().__init__(**kwargs) self.backup_management_type = backup_management_type self.workload_type = workload_type - self.workload_item_type = None # type: Optional[str] + self.workload_item_type: Optional[str] = None self.friendly_name = friendly_name self.protection_state = protection_state @@ -5938,7 +5938,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.workload_item_type = "AzureVmWorkloadItem" # type: str + self.workload_item_type: str = "AzureVmWorkloadItem" self.parent_name = parent_name self.server_name = server_name self.is_auto_protectable = is_auto_protectable @@ -6079,7 +6079,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.protectable_item_type = "AzureVmWorkloadProtectableItem" # type: str + self.protectable_item_type: str = "AzureVmWorkloadProtectableItem" self.parent_name = parent_name self.parent_unique_name = parent_unique_name self.server_name = server_name @@ -6361,7 +6361,7 @@ def __init__( # pylint: disable=too-many-locals soft_delete_retention_period=soft_delete_retention_period, **kwargs ) - self.protected_item_type = "AzureVmWorkloadProtectedItem" # type: str + self.protected_item_type: str = "AzureVmWorkloadProtectedItem" self.friendly_name = None self.server_name = server_name self.parent_name = parent_name @@ -6534,7 +6534,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.backup_management_type = "AzureWorkload" # type: str + self.backup_management_type: str = "AzureWorkload" self.work_load_type = work_load_type self.settings = settings self.sub_protection_policy = sub_protection_policy @@ -6812,7 +6812,7 @@ def __init__( # pylint: disable=too-many-locals kpis_healths=kpis_healths, **kwargs ) - self.protected_item_type = "AzureVmWorkloadSAPAseDatabase" # type: str + self.protected_item_type: str = "AzureVmWorkloadSAPAseDatabase" class AzureVmWorkloadSAPAseDatabaseWorkloadItem(AzureVmWorkloadItem): @@ -6909,7 +6909,7 @@ def __init__( sub_workload_item_count=sub_workload_item_count, **kwargs ) - self.workload_item_type = "SAPAseDatabase" # type: str + self.workload_item_type: str = "SAPAseDatabase" class AzureVmWorkloadSAPAseSystemProtectableItem( @@ -7035,7 +7035,7 @@ def __init__( prebackupvalidation=prebackupvalidation, **kwargs ) - self.protectable_item_type = "SAPAseSystem" # type: str + self.protectable_item_type: str = "SAPAseSystem" class AzureVmWorkloadSAPAseSystemWorkloadItem(AzureVmWorkloadItem): @@ -7132,7 +7132,7 @@ def __init__( sub_workload_item_count=sub_workload_item_count, **kwargs ) - self.workload_item_type = "SAPAseSystem" # type: str + self.workload_item_type: str = "SAPAseSystem" class AzureVmWorkloadSAPHanaDatabaseProtectableItem( @@ -7258,7 +7258,7 @@ def __init__( prebackupvalidation=prebackupvalidation, **kwargs ) - self.protectable_item_type = "SAPHanaDatabase" # type: str + self.protectable_item_type: str = "SAPHanaDatabase" class AzureVmWorkloadSAPHanaDatabaseProtectedItem( @@ -7532,7 +7532,7 @@ def __init__( # pylint: disable=too-many-locals kpis_healths=kpis_healths, **kwargs ) - self.protected_item_type = "AzureVmWorkloadSAPHanaDatabase" # type: str + self.protected_item_type: str = "AzureVmWorkloadSAPHanaDatabase" class AzureVmWorkloadSAPHanaDatabaseWorkloadItem(AzureVmWorkloadItem): @@ -7629,7 +7629,7 @@ def __init__( sub_workload_item_count=sub_workload_item_count, **kwargs ) - self.workload_item_type = "SAPHanaDatabase" # type: str + self.workload_item_type: str = "SAPHanaDatabase" class AzureVmWorkloadSAPHanaDBInstance(AzureVmWorkloadProtectableItem): # pylint: disable=too-many-instance-attributes @@ -7753,7 +7753,7 @@ def __init__( prebackupvalidation=prebackupvalidation, **kwargs ) - self.protectable_item_type = "SAPHanaDBInstance" # type: str + self.protectable_item_type: str = "SAPHanaDBInstance" class AzureVmWorkloadSAPHanaDBInstanceProtectedItem( @@ -8027,7 +8027,7 @@ def __init__( # pylint: disable=too-many-locals kpis_healths=kpis_healths, **kwargs ) - self.protected_item_type = "AzureVmWorkloadSAPHanaDBInstance" # type: str + self.protected_item_type: str = "AzureVmWorkloadSAPHanaDBInstance" class AzureVmWorkloadSAPHanaHSR(AzureVmWorkloadProtectableItem): # pylint: disable=too-many-instance-attributes @@ -8151,7 +8151,7 @@ def __init__( prebackupvalidation=prebackupvalidation, **kwargs ) - self.protectable_item_type = "SAPHanaHSR" # type: str + self.protectable_item_type: str = "SAPHanaHSR" class AzureVmWorkloadSAPHanaSystemProtectableItem( @@ -8277,7 +8277,7 @@ def __init__( prebackupvalidation=prebackupvalidation, **kwargs ) - self.protectable_item_type = "SAPHanaSystem" # type: str + self.protectable_item_type: str = "SAPHanaSystem" class AzureVmWorkloadSAPHanaSystemWorkloadItem(AzureVmWorkloadItem): @@ -8374,7 +8374,7 @@ def __init__( sub_workload_item_count=sub_workload_item_count, **kwargs ) - self.workload_item_type = "SAPHanaSystem" # type: str + self.workload_item_type: str = "SAPHanaSystem" class AzureVmWorkloadSQLAvailabilityGroupProtectableItem( @@ -8500,7 +8500,7 @@ def __init__( prebackupvalidation=prebackupvalidation, **kwargs ) - self.protectable_item_type = "SQLAvailabilityGroupContainer" # type: str + self.protectable_item_type: str = "SQLAvailabilityGroupContainer" class AzureVmWorkloadSQLDatabaseProtectableItem( @@ -8626,7 +8626,7 @@ def __init__( prebackupvalidation=prebackupvalidation, **kwargs ) - self.protectable_item_type = "SQLDataBase" # type: str + self.protectable_item_type: str = "SQLDataBase" class AzureVmWorkloadSQLDatabaseProtectedItem( @@ -8900,7 +8900,7 @@ def __init__( # pylint: disable=too-many-locals kpis_healths=kpis_healths, **kwargs ) - self.protected_item_type = "AzureVmWorkloadSQLDatabase" # type: str + self.protected_item_type: str = "AzureVmWorkloadSQLDatabase" class AzureVmWorkloadSQLDatabaseWorkloadItem(AzureVmWorkloadItem): @@ -8997,7 +8997,7 @@ def __init__( sub_workload_item_count=sub_workload_item_count, **kwargs ) - self.workload_item_type = "SQLDataBase" # type: str + self.workload_item_type: str = "SQLDataBase" class AzureVmWorkloadSQLInstanceProtectableItem( @@ -9123,7 +9123,7 @@ def __init__( prebackupvalidation=prebackupvalidation, **kwargs ) - self.protectable_item_type = "SQLInstance" # type: str + self.protectable_item_type: str = "SQLInstance" class AzureVmWorkloadSQLInstanceWorkloadItem(AzureVmWorkloadItem): # pylint: disable=too-many-instance-attributes @@ -9228,7 +9228,7 @@ def __init__( sub_workload_item_count=sub_workload_item_count, **kwargs ) - self.workload_item_type = "SQLInstance" # type: str + self.workload_item_type: str = "SQLInstance" self.data_directory_paths = data_directory_paths @@ -9317,7 +9317,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.protection_intent_item_type = "AzureWorkloadAutoProtectionIntent" # type: str + self.protection_intent_item_type: str = "AzureWorkloadAutoProtectionIntent" class AzureWorkloadBackupRequest(BackupRequest): @@ -9370,7 +9370,7 @@ def __init__( :paramtype recovery_point_expiry_time_in_utc: ~datetime.datetime """ super().__init__(**kwargs) - self.object_type = "AzureWorkloadBackupRequest" # type: str + self.object_type: str = "AzureWorkloadBackupRequest" self.backup_type = backup_type self.enable_compression = enable_compression self.recovery_point_expiry_time_in_utc = recovery_point_expiry_time_in_utc @@ -9454,7 +9454,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.protection_intent_item_type = "AzureWorkloadContainerAutoProtectionIntent" # type: str + self.protection_intent_item_type: str = "AzureWorkloadContainerAutoProtectionIntent" class AzureWorkloadContainerExtendedInfo(_serialization.Model): @@ -9673,7 +9673,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "AzureWorkloadJob" # type: str + self.job_type: str = "AzureWorkloadJob" self.workload_type = workload_type self.duration = duration self.actions_info = actions_info @@ -9819,7 +9819,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointMoveReadinessInfo] """ super().__init__(**kwargs) - self.object_type = "AzureWorkloadRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadRecoveryPoint" self.recovery_point_time_in_utc = recovery_point_time_in_utc self.type = type self.recovery_point_tier_details = recovery_point_tier_details @@ -9906,7 +9906,7 @@ def __init__( recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs ) - self.object_type = "AzureWorkloadPointInTimeRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadPointInTimeRecoveryPoint" self.time_ranges = time_ranges @@ -9998,7 +9998,7 @@ def __init__( :paramtype target_virtual_machine_id: str """ super().__init__(**kwargs) - self.object_type = "AzureWorkloadRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadRestoreRequest" self.recovery_type = recovery_type self.source_resource_id = source_resource_id self.property_bag = property_bag @@ -10097,7 +10097,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadPointInTimeRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadPointInTimeRestoreRequest" self.point_in_time = point_in_time @@ -10175,7 +10175,7 @@ def __init__( time_ranges=time_ranges, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): @@ -10272,7 +10272,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadSAPHanaRestoreRequest" class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreRequest): @@ -10374,7 +10374,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" self.point_in_time = point_in_time @@ -10480,7 +10480,7 @@ def __init__( point_in_time=point_in_time, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest" # type: str + self.object_type: str = "AzureWorkloadSAPHanaPointInTimeRestoreWithRehydrateRequest" self.recovery_point_rehydration_info = recovery_point_rehydration_info @@ -10549,7 +10549,7 @@ def __init__( recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadSAPHanaRecoveryPoint" class AzureWorkloadSAPHanaRestoreWithRehydrateRequest(AzureWorkloadSAPHanaRestoreRequest): @@ -10647,7 +10647,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaRestoreWithRehydrateRequest" # type: str + self.object_type: str = "AzureWorkloadSAPHanaRestoreWithRehydrateRequest" self.recovery_point_rehydration_info = recovery_point_rehydration_info @@ -10741,7 +10741,7 @@ def __init__( protection_state=protection_state, **kwargs ) - self.protection_intent_item_type = "AzureWorkloadSQLAutoProtectionIntent" # type: str + self.protection_intent_item_type: str = "AzureWorkloadSQLAutoProtectionIntent" self.workload_item_type = workload_item_type @@ -10831,7 +10831,7 @@ def __init__( recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs ) - self.object_type = "AzureWorkloadSQLRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadSQLRecoveryPoint" self.extended_info = extended_info @@ -10923,7 +10923,7 @@ def __init__( extended_info=extended_info, **kwargs ) - self.object_type = "AzureWorkloadSQLPointInTimeRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadSQLPointInTimeRecoveryPoint" self.time_ranges = time_ranges @@ -11045,7 +11045,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadSQLRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadSQLRestoreRequest" self.should_use_alternate_target_location = should_use_alternate_target_location self.is_non_recoverable = is_non_recoverable self.alternate_directory_paths = alternate_directory_paths @@ -11179,7 +11179,7 @@ def __init__( alternate_directory_paths=alternate_directory_paths, **kwargs ) - self.object_type = "AzureWorkloadSQLPointInTimeRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadSQLPointInTimeRestoreRequest" self.point_in_time = point_in_time @@ -11314,7 +11314,7 @@ def __init__( point_in_time=point_in_time, **kwargs ) - self.object_type = "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest" # type: str + self.object_type: str = "AzureWorkloadSQLPointInTimeRestoreWithRehydrateRequest" self.recovery_point_rehydration_info = recovery_point_rehydration_info @@ -11476,7 +11476,7 @@ def __init__( alternate_directory_paths=alternate_directory_paths, **kwargs ) - self.object_type = "AzureWorkloadSQLRestoreWithRehydrateRequest" # type: str + self.object_type: str = "AzureWorkloadSQLRestoreWithRehydrateRequest" self.recovery_point_rehydration_info = recovery_point_rehydration_info @@ -13750,7 +13750,7 @@ def __init__( extended_info=extended_info, **kwargs ) - self.backup_engine_type = "DpmBackupEngine" # type: str + self.backup_engine_type: str = "DpmBackupEngine" class DPMContainerExtendedInfo(_serialization.Model): @@ -13937,7 +13937,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "DpmJob" # type: str + self.job_type: str = "DpmJob" self.duration = duration self.dpm_server_name = dpm_server_name self.container_name = container_name @@ -14234,7 +14234,7 @@ def __init__( soft_delete_retention_period=soft_delete_retention_period, **kwargs ) - self.protected_item_type = "DPMProtectedItem" # type: str + self.protected_item_type: str = "DPMProtectedItem" self.friendly_name = friendly_name self.backup_engine_name = backup_engine_name self.protection_state = protection_state @@ -14504,7 +14504,7 @@ class OperationResultInfoBase(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class ExportJobsOperationResultInfo(OperationResultInfoBase): @@ -14558,7 +14558,7 @@ def __init__( :paramtype excel_file_blob_sas_key: str """ super().__init__(**kwargs) - self.object_type = "ExportJobsOperationResultInfo" # type: str + self.object_type: str = "ExportJobsOperationResultInfo" self.blob_url = blob_url self.blob_sas_key = blob_sas_key self.excel_file_blob_url = excel_file_blob_url @@ -14696,7 +14696,7 @@ def __init__( protectable_object_type=protectable_object_type, **kwargs ) - self.container_type = "GenericContainer" # type: str + self.container_type: str = "GenericContainer" self.fabric_name = fabric_name self.extended_information = extended_information @@ -14948,7 +14948,7 @@ def __init__( # pylint: disable=too-many-locals soft_delete_retention_period=soft_delete_retention_period, **kwargs ) - self.protected_item_type = "GenericProtectedItem" # type: str + self.protected_item_type: str = "GenericProtectedItem" self.friendly_name = friendly_name self.policy_state = policy_state self.protection_state = protection_state @@ -15023,7 +15023,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.backup_management_type = "GenericProtectionPolicy" # type: str + self.backup_management_type: str = "GenericProtectionPolicy" self.sub_protection_policy = sub_protection_policy self.time_zone = time_zone self.fabric_name = fabric_name @@ -15080,7 +15080,7 @@ def __init__( :paramtype recovery_point_additional_info: str """ super().__init__(**kwargs) - self.object_type = "GenericRecoveryPoint" # type: str + self.object_type: str = "GenericRecoveryPoint" self.friendly_name = friendly_name self.recovery_point_type = recovery_point_type self.recovery_point_time = recovery_point_time @@ -15177,7 +15177,7 @@ def __init__(self, *, recovery_point_expiry_time_in_utc: Optional[datetime.datet :paramtype recovery_point_expiry_time_in_utc: ~datetime.datetime """ super().__init__(**kwargs) - self.object_type = "IaasVMBackupRequest" # type: str + self.object_type: str = "IaasVMBackupRequest" self.recovery_point_expiry_time_in_utc = recovery_point_expiry_time_in_utc @@ -15237,7 +15237,7 @@ def __init__( :paramtype renew_existing_registration: bool """ super().__init__(**kwargs) - self.object_type = "IaasVMILRRegistrationRequest" # type: str + self.object_type: str = "IaasVMILRRegistrationRequest" self.recovery_point_id = recovery_point_id self.virtual_machine_id = virtual_machine_id self.initiator_name = initiator_name @@ -15383,7 +15383,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointMoveReadinessInfo] """ super().__init__(**kwargs) - self.object_type = "IaasVMRecoveryPoint" # type: str + self.object_type: str = "IaasVMRecoveryPoint" self.recovery_point_type = recovery_point_type self.recovery_point_time = recovery_point_time self.recovery_point_additional_info = recovery_point_additional_info @@ -15599,7 +15599,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.IdentityBasedRestoreDetails """ super().__init__(**kwargs) - self.object_type = "IaasVMRestoreRequest" # type: str + self.object_type: str = "IaasVMRestoreRequest" self.recovery_point_id = recovery_point_id self.recovery_type = recovery_type self.source_resource_id = source_resource_id @@ -15848,7 +15848,7 @@ def __init__( identity_based_restore_details=identity_based_restore_details, **kwargs ) - self.object_type = "IaasVMRestoreWithRehydrationRequest" # type: str + self.object_type: str = "IaasVMRestoreWithRehydrationRequest" self.recovery_point_rehydration_info = recovery_point_rehydration_info @@ -16459,7 +16459,7 @@ class SchedulePolicy(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.schedule_policy_type = None # type: Optional[str] + self.schedule_policy_type: Optional[str] = None class LogSchedulePolicy(SchedulePolicy): @@ -16491,7 +16491,7 @@ def __init__(self, *, schedule_frequency_in_mins: Optional[int] = None, **kwargs :paramtype schedule_frequency_in_mins: int """ super().__init__(**kwargs) - self.schedule_policy_type = "LogSchedulePolicy" # type: str + self.schedule_policy_type: str = "LogSchedulePolicy" self.schedule_frequency_in_mins = schedule_frequency_in_mins @@ -16526,7 +16526,7 @@ class RetentionPolicy(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.retention_policy_type = None # type: Optional[str] + self.retention_policy_type: Optional[str] = None class LongTermRetentionPolicy(RetentionPolicy): @@ -16587,7 +16587,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.YearlyRetentionSchedule """ super().__init__(**kwargs) - self.retention_policy_type = "LongTermRetentionPolicy" # type: str + self.retention_policy_type: str = "LongTermRetentionPolicy" self.daily_schedule = daily_schedule self.weekly_schedule = weekly_schedule self.monthly_schedule = monthly_schedule @@ -16615,7 +16615,7 @@ class LongTermSchedulePolicy(SchedulePolicy): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.schedule_policy_type = "LongTermSchedulePolicy" # type: str + self.schedule_policy_type: str = "LongTermSchedulePolicy" class MabContainer(ProtectionContainer): # pylint: disable=too-many-instance-attributes @@ -16747,7 +16747,7 @@ def __init__( protectable_object_type=protectable_object_type, **kwargs ) - self.container_type = "Windows" # type: str + self.container_type: str = "Windows" self.can_re_register = can_re_register self.container_id = container_id self.protected_item_count = protected_item_count @@ -17098,7 +17098,7 @@ def __init__( # pylint: disable=too-many-locals soft_delete_retention_period=soft_delete_retention_period, **kwargs ) - self.protected_item_type = "MabFileFolderProtectedItem" # type: str + self.protected_item_type: str = "MabFileFolderProtectedItem" self.friendly_name = friendly_name self.computer_name = computer_name self.last_backup_status = last_backup_status @@ -17295,7 +17295,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "MabJob" # type: str + self.job_type: str = "MabJob" self.duration = duration self.actions_info = actions_info self.mab_server_name = mab_server_name @@ -17456,7 +17456,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.backup_management_type = "MAB" # type: str + self.backup_management_type: str = "MAB" self.schedule_policy = schedule_policy self.retention_policy = retention_policy @@ -17688,7 +17688,7 @@ def __init__(self, *, job_list: Optional[List[str]] = None, **kwargs): :paramtype job_list: list[str] """ super().__init__(**kwargs) - self.object_type = "OperationResultInfo" # type: str + self.object_type: str = "OperationResultInfo" self.job_list = job_list @@ -17940,7 +17940,7 @@ class OperationStatusExtendedInfo(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class OperationStatusJobExtendedInfo(OperationStatusExtendedInfo): @@ -17970,7 +17970,7 @@ def __init__(self, *, job_id: Optional[str] = None, **kwargs): :paramtype job_id: str """ super().__init__(**kwargs) - self.object_type = "OperationStatusJobExtendedInfo" # type: str + self.object_type: str = "OperationStatusJobExtendedInfo" self.job_id = job_id @@ -18009,7 +18009,7 @@ def __init__( :paramtype failed_jobs_error: dict[str, str] """ super().__init__(**kwargs) - self.object_type = "OperationStatusJobsExtendedInfo" # type: str + self.object_type: str = "OperationStatusJobsExtendedInfo" self.job_ids = job_ids self.failed_jobs_error = failed_jobs_error @@ -18043,7 +18043,7 @@ def __init__(self, *, recovery_target: Optional["_models.InstantItemRecoveryTarg ~azure.mgmt.recoveryservicesbackup.activestamp.models.InstantItemRecoveryTarget """ super().__init__(**kwargs) - self.object_type = "OperationStatusProvisionILRExtendedInfo" # type: str + self.object_type: str = "OperationStatusProvisionILRExtendedInfo" self.recovery_target = recovery_target @@ -18076,7 +18076,7 @@ def __init__(self, *, validate_operation_response: Optional["_models.ValidateOpe ~azure.mgmt.recoveryservicesbackup.activestamp.models.ValidateOperationResponse """ super().__init__(**kwargs) - self.object_type = "OperationStatusValidateOperationExtendedInfo" # type: str + self.object_type: str = "OperationStatusValidateOperationExtendedInfo" self.validate_operation_response = validate_operation_response @@ -18242,7 +18242,7 @@ class VaultStorageConfigOperationResultResponse(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class PrepareDataMoveResponse(VaultStorageConfigOperationResultResponse): @@ -18283,7 +18283,7 @@ def __init__( :paramtype source_vault_properties: dict[str, str] """ super().__init__(**kwargs) - self.object_type = "PrepareDataMoveResponse" # type: str + self.object_type: str = "PrepareDataMoveResponse" self.correlation_id = correlation_id self.source_vault_properties = source_vault_properties @@ -19995,7 +19995,7 @@ def __init__(self, *, retention_duration: Optional["_models.RetentionDuration"] ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDuration """ super().__init__(**kwargs) - self.retention_policy_type = "SimpleRetentionPolicy" # type: str + self.retention_policy_type: str = "SimpleRetentionPolicy" self.retention_duration = retention_duration @@ -20062,7 +20062,7 @@ def __init__( :paramtype schedule_weekly_frequency: int """ super().__init__(**kwargs) - self.schedule_policy_type = "SimpleSchedulePolicy" # type: str + self.schedule_policy_type: str = "SimpleSchedulePolicy" self.schedule_run_frequency = schedule_run_frequency self.schedule_run_days = schedule_run_days self.schedule_run_times = schedule_run_times @@ -20126,7 +20126,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.activestamp.models.WeeklySchedule """ super().__init__(**kwargs) - self.schedule_policy_type = "SimpleSchedulePolicyV2" # type: str + self.schedule_policy_type: str = "SimpleSchedulePolicyV2" self.schedule_run_frequency = schedule_run_frequency self.hourly_schedule = hourly_schedule self.daily_schedule = daily_schedule @@ -20620,7 +20620,7 @@ class ValidateOperationRequest(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class ValidateRestoreOperationRequest(ValidateOperationRequest): @@ -20656,7 +20656,7 @@ def __init__(self, *, restore_request: Optional["_models.RestoreRequest"] = None ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequest """ super().__init__(**kwargs) - self.object_type = "ValidateRestoreOperationRequest" # type: str + self.object_type: str = "ValidateRestoreOperationRequest" self.restore_request = restore_request @@ -20688,7 +20688,7 @@ def __init__(self, *, restore_request: Optional["_models.RestoreRequest"] = None ~azure.mgmt.recoveryservicesbackup.activestamp.models.RestoreRequest """ super().__init__(restore_request=restore_request, **kwargs) - self.object_type = "ValidateIaasVMRestoreOperationRequest" # type: str + self.object_type: str = "ValidateIaasVMRestoreOperationRequest" class ValidateOperationResponse(_serialization.Model): @@ -20849,7 +20849,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "VaultJob" # type: str + self.job_type: str = "VaultJob" self.duration = duration self.actions_info = actions_info self.error_details = error_details diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py index 619214e67304..2fd9d9f59b4b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/__init__.py @@ -60,7 +60,7 @@ from ._resource_guard_proxy_operations import ResourceGuardProxyOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py index aebc52ba816d..3f7c76de4029 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +69,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,7 +97,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -105,7 +114,7 @@ def build_get_request( "backupEngineName": _SERIALIZER.url("backup_engine_name", backup_engine_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -170,8 +179,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupEngineBaseResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupEngineBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,7 +207,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -212,7 +223,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -220,13 +231,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupEngineBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -239,7 +250,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines" + } @distributed_trace def get( @@ -280,8 +293,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupEngineBaseResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupEngineBaseResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -296,9 +311,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -315,4 +330,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py index 4c506d899784..a0d129c04221 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +69,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,8 +132,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -151,7 +160,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -167,7 +176,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -175,13 +184,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -194,4 +203,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py index 2f5cf10ddb82..53ad57f76e9e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,8 +127,10 @@ def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -134,9 +143,9 @@ def get( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -149,4 +158,6 @@ def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py index 0ff78e9d271d..2faaa391d33f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,8 +125,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -132,9 +141,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -151,4 +160,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py index 9b2471512010..351a1d8e530a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -113,8 +120,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionPolicyResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -138,7 +147,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -154,7 +163,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -162,13 +171,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProtectionPolicyResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -181,4 +190,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py index 5b3afbb40df8..74b457ecb21f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +69,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -128,8 +135,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkloadProtectableItemResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.WorkloadProtectableItemResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -154,7 +163,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -170,7 +179,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -178,13 +187,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("WorkloadProtectableItemResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -197,4 +206,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py index 98fd9cedd224..b87a1b204725 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +69,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +133,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectedItemResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -152,7 +161,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -168,7 +177,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +185,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProtectedItemResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,4 +204,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py index 5712f3d043aa..d6f58d65fa19 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +118,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionContainerResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -136,7 +145,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -152,7 +161,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -160,13 +169,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProtectionContainerResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -179,4 +188,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py index bd8d11521688..47cf20ddc776 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +69,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +133,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionIntentResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -152,7 +161,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -168,7 +177,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +185,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProtectionIntentResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,4 +204,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents"} # type: ignore + list.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py index 32fa90c672f7..24031bf86cf7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,8 +74,10 @@ def build_update_request(vault_name: str, resource_group_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_update_request(vault_name: str, resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,8 +151,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceEncryptionConfigExtendedResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupResourceEncryptionConfigExtendedResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -155,9 +166,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -175,7 +186,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig" + } @overload def update( # pylint: disable=inconsistent-return-statements @@ -273,9 +286,11 @@ def update( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -298,9 +313,9 @@ def update( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -314,4 +329,6 @@ def update( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py index 963b995d7f35..7508e462cee1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,8 +74,10 @@ def build_update_request(vault_name: str, resource_group_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_update_request(vault_name: str, resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,8 +108,10 @@ def build_patch_request(vault_name: str, resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +125,7 @@ def build_patch_request(vault_name: str, resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,8 +182,10 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupResourceConfigResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -184,9 +197,9 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +217,9 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + get.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } @overload def update( @@ -300,9 +315,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupResourceConfigResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -325,9 +342,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -345,7 +362,9 @@ def update( return deserialized - update.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + update.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } @overload def patch( # pylint: disable=inconsistent-return-statements @@ -441,9 +460,11 @@ def patch( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -466,9 +487,9 @@ def patch( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -482,4 +503,6 @@ def patch( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - patch.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + patch.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py index 1cec46727fa2..fe691aea368a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,9 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,8 +74,10 @@ def build_update_request(vault_name: str, resource_group_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +91,7 @@ def build_update_request(vault_name: str, resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,8 +108,10 @@ def build_put_request(vault_name: str, resource_group_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +125,7 @@ def build_put_request(vault_name: str, resource_group_name: str, subscription_id "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -173,8 +184,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupResourceVaultConfigResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -186,9 +199,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -206,7 +219,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" + } @overload def update( @@ -302,9 +317,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupResourceVaultConfigResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -327,9 +344,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -347,7 +364,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" + } @overload def put( @@ -443,9 +462,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceVaultConfigResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupResourceVaultConfigResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -468,9 +489,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -488,4 +509,6 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py index 170844b2df3d..e2a14fb9a1d2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,10 @@ def build_get_request(azure_region: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_get_request(azure_region: str, subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,9 +171,11 @@ def get( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupStatusResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupStatusResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -188,9 +197,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -207,4 +216,6 @@ def get( return deserialized - get.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus"} # type: ignore + get.metadata = { + "url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py index e77f67dfdca0..68853cf0ab69 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +69,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +133,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupManagementUsageList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupManagementUsageList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -152,7 +161,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -168,7 +177,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +185,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupManagementUsageList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -195,4 +204,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore + list.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py index 82a210e11d7a..b14eb4272a49 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,7 @@ def build_list_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,8 +145,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.WorkloadItemResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.WorkloadItemResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -166,7 +175,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -182,7 +191,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -190,13 +199,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("WorkloadItemResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -209,4 +218,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py index ebf0ee88c1ac..b6f220a78d24 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,8 +51,10 @@ def build_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +71,7 @@ def build_trigger_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -222,9 +229,11 @@ def trigger( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -250,9 +259,9 @@ def trigger( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -265,4 +274,6 @@ def trigger( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup"} # type: ignore + trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py index bceb1960673f..de6cf2b1bf0f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,8 +123,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.VaultStorageConfigOperationResultResponse]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.VaultStorageConfigOperationResultResponse]] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -130,9 +139,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -152,4 +161,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py index 311e45520ddf..f3d536416458 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_deleted_protection_containers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_list_request( "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +118,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionContainerResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -136,7 +145,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -152,7 +161,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -160,13 +169,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProtectionContainerResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -179,4 +188,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupDeletedProtectionContainers" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py index c9f3cb6ba229..bbe36b2c690f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -117,8 +124,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationResultInfoBaseResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationResultInfoBaseResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -131,9 +140,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -150,8 +159,10 @@ def get( deserialized = self._deserialize("OperationResultInfoBaseResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py index 79f530ef9c23..cad66751ee8e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,10 @@ def build_validate_request(azure_region: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_validate_request(azure_region: str, subscription_id: str, **kwargs: An "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -167,9 +174,11 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.AzureVMResourceFeatureSupportResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureVMResourceFeatureSupportResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -191,9 +200,9 @@ def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -210,4 +219,6 @@ def validate( return deserialized - validate.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures"} # type: ignore + validate.metadata = { + "url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py index a579c5b6eeff..e3b640a9f5ab 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,8 +52,10 @@ def build_provision_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,7 @@ def build_provision_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -92,7 +99,9 @@ def build_revoke_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -110,7 +119,7 @@ def build_revoke_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -290,9 +299,11 @@ def provision( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -319,9 +330,9 @@ def provision( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -334,7 +345,9 @@ def provision( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - provision.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery"} # type: ignore + provision.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery" + } @distributed_trace def revoke( # pylint: disable=inconsistent-return-statements @@ -383,8 +396,10 @@ def revoke( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_revoke_request( vault_name=vault_name, @@ -400,9 +415,9 @@ def revoke( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -415,4 +430,6 @@ def revoke( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - revoke.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery"} # type: ignore + revoke.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py index d43736bcbc0c..5bccba96316c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_trigger_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,8 +122,10 @@ def trigger( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_trigger_request( vault_name=vault_name, @@ -129,9 +138,9 @@ def trigger( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -144,4 +153,6 @@ def trigger( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel"} # type: ignore + trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py index 43359b52029b..02be3525c0f4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -112,8 +119,10 @@ def get(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -126,9 +135,9 @@ def get(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -145,4 +154,6 @@ def get(self, vault_name: str, resource_group_name: str, job_name: str, **kwargs return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py index cfa4e6b2749e..ce7c6226a57e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,8 +125,10 @@ def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -133,9 +142,9 @@ def get( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -148,4 +157,6 @@ def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py index 5b9f752ecb07..eac6e385469c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_export_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_export_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -115,8 +122,10 @@ def export( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_export_request( vault_name=vault_name, @@ -129,9 +138,9 @@ def export( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -144,4 +153,6 @@ def export( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - export.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport"} # type: ignore + export.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py index 578749cf1819..88ab5213b087 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,8 +45,10 @@ def build_validate_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_validate_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -182,9 +189,11 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ValidateOperationsResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ValidateOperationsResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -207,9 +216,9 @@ def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -226,4 +235,6 @@ def validate( return deserialized - validate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation"} # type: ignore + validate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py index d7e51230ee06..e7b2e63129df 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,8 +95,10 @@ def list(self, **kwargs: Any) -> Iterable["_models.ClientDiscoveryValueForSingle _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ClientDiscoveryResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -109,7 +118,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -125,7 +134,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +142,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ClientDiscoveryResponse", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -152,4 +161,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.RecoveryServices/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.RecoveryServices/operations"} diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py index 39d76e383ede..a06b2a65a34e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +70,7 @@ def build_get_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -84,8 +91,10 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +111,7 @@ def build_put_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -125,7 +134,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -142,7 +153,7 @@ def build_delete_request( ), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -201,8 +212,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -215,9 +228,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,7 +248,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _put_initial( self, @@ -256,9 +271,11 @@ def _put_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -282,9 +299,9 @@ def _put_initial( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -301,11 +318,13 @@ def _put_initial( deserialized = self._deserialize("PrivateEndpointConnectionResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _put_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _put_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @overload def begin_put( @@ -429,14 +448,16 @@ def begin_put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PrivateEndpointConnectionResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnectionResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: - raw_result = self._put_initial( # type: ignore + raw_result = self._put_initial( vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, @@ -457,7 +478,7 @@ def get_long_running_output(pipeline_response): return deserialized if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -469,9 +490,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, private_endpoint_connection_name: str, **kwargs: Any @@ -487,8 +510,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -501,9 +526,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -516,7 +541,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } @distributed_trace def begin_delete( @@ -546,11 +573,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore vault_name=vault_name, @@ -569,7 +598,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -581,6 +610,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py index a6ba01621c4f..43cd2649e8fe 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,9 @@ def build_get_operation_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +70,7 @@ def build_get_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -131,8 +138,10 @@ def get_operation_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_operation_status_request( vault_name=vault_name, @@ -146,9 +155,9 @@ def get_operation_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -166,4 +175,6 @@ def get_operation_status( return deserialized - get_operation_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}"} # type: ignore + get_operation_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py index f37154db6ac8..84eaffbe2228 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +70,7 @@ def build_list_request( "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -120,8 +127,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectableContainerResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectableContainerResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -146,7 +155,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -162,7 +171,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -170,13 +179,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProtectableContainerResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -189,4 +198,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py index bd80d5a2c65b..3a3e852f88d2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +72,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -138,8 +145,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectedItemResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.ProtectedItemResource]] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -155,9 +164,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -176,4 +185,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py index 3813f8a48ed2..8c4398971556 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,7 +52,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +72,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -142,8 +149,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -159,9 +168,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -178,4 +187,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py index 8b82269e40ef..57f35fd833e9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +72,7 @@ def build_get_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -90,8 +97,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +117,7 @@ def build_create_or_update_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -133,7 +142,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,7 +161,7 @@ def build_delete_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -224,8 +235,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectedItemResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -241,9 +254,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -260,7 +273,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" + } @overload def create_or_update( @@ -391,9 +406,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectedItemResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ProtectedItemResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -419,9 +436,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -440,7 +457,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -483,8 +502,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -499,9 +520,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -514,4 +535,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py index 1edcec69f405..3cbe34743cd6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -46,7 +51,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -63,7 +70,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -134,8 +141,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionContainerResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.ProtectionContainerResource]] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -150,9 +159,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -171,4 +180,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py index 5f605cf60c0d..73a67634bab2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,8 +125,10 @@ def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -133,9 +142,9 @@ def get( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -148,4 +157,6 @@ def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py index d367044f2236..d416abfd35ef 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,7 +50,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +68,7 @@ def build_get_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -83,8 +90,10 @@ def build_register_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +109,7 @@ def build_register_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -124,7 +133,9 @@ def build_unregister_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -140,7 +151,7 @@ def build_unregister_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -164,7 +175,9 @@ def build_inquire_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -180,7 +193,7 @@ def build_inquire_request( "containerName": _SERIALIZER.url("container_name", container_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -205,7 +218,9 @@ def build_refresh_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -220,7 +235,7 @@ def build_refresh_request( "fabricName": _SERIALIZER.url("fabric_name", fabric_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -283,8 +298,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionContainerResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionContainerResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -298,9 +315,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -317,7 +334,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" + } @overload def register( @@ -443,9 +462,11 @@ def register( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionContainerResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ProtectionContainerResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -470,9 +491,9 @@ def register( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -491,7 +512,9 @@ def register( return deserialized - register.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + register.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" + } @distributed_trace def unregister( # pylint: disable=inconsistent-return-statements @@ -528,8 +551,10 @@ def unregister( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_unregister_request( vault_name=vault_name, @@ -543,9 +568,9 @@ def unregister( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -558,7 +583,9 @@ def unregister( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - unregister.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore + unregister.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}" + } @distributed_trace def inquire( # pylint: disable=inconsistent-return-statements @@ -602,8 +629,10 @@ def inquire( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_inquire_request( vault_name=vault_name, @@ -618,9 +647,9 @@ def inquire( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -633,7 +662,9 @@ def inquire( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - inquire.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire"} # type: ignore + inquire.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire" + } @distributed_trace def refresh( # pylint: disable=inconsistent-return-statements @@ -669,8 +700,10 @@ def refresh( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_refresh_request( vault_name=vault_name, @@ -684,9 +717,9 @@ def refresh( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -699,4 +732,6 @@ def refresh( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - refresh.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers"} # type: ignore + refresh.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py index ac95305794a8..71821bed6cd6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,10 @@ def build_validate_request(azure_region: str, subscription_id: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +59,7 @@ def build_validate_request(azure_region: str, subscription_id: str, **kwargs: An "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -76,7 +83,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +101,7 @@ def build_get_request( "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -114,8 +123,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -131,7 +142,7 @@ def build_create_or_update_request( "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -154,7 +165,9 @@ def build_delete_request( ) -> HttpRequest: _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) # Construct URL _url = kwargs.pop( "template_url", @@ -168,7 +181,7 @@ def build_delete_request( "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -306,9 +319,11 @@ def validate( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.PreValidateEnableBackupResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PreValidateEnableBackupResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -330,9 +345,9 @@ def validate( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -349,7 +364,9 @@ def validate( return deserialized - validate.metadata = {"url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection"} # type: ignore + validate.metadata = { + "url": "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection" + } @distributed_trace def get( @@ -384,8 +401,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionIntentResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -399,9 +418,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -418,7 +437,9 @@ def get( return deserialized - get.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + get.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" + } @overload def create_or_update( @@ -532,9 +553,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionIntentResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ProtectionIntentResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -559,9 +582,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -578,7 +601,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + create_or_update.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -611,8 +636,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -626,9 +653,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -641,4 +668,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore + delete.metadata = { + "url": "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py index f596f7b8f2ec..d005b2ec2eda 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +64,7 @@ def build_get_request( "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,8 +81,10 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +99,7 @@ def build_create_or_update_request( "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -109,7 +118,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -124,7 +135,7 @@ def build_delete_request( "policyName": _SERIALIZER.url("policy_name", policy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -185,8 +196,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionPolicyResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -199,9 +212,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -218,7 +231,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" + } @overload def create_or_update( @@ -329,9 +344,11 @@ def create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ProtectionPolicyResource]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Optional[_models.ProtectionPolicyResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -355,9 +372,9 @@ def create_or_update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -376,7 +393,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, policy_name: str, **kwargs: Any @@ -392,8 +411,10 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -406,9 +427,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -421,7 +442,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" + } @distributed_trace def begin_delete( @@ -453,11 +476,13 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._delete_initial( # type: ignore vault_name=vault_name, @@ -476,7 +501,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -488,6 +513,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py index 5e2ade0c55ac..70c93a5342e3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -118,8 +125,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectionPolicyResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectionPolicyResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -133,9 +142,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -152,4 +161,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py index b27528dddf71..9ffaf83d25f9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -56,7 +63,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,8 +129,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -137,9 +146,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -156,4 +165,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py index 89de00aa4908..e39e44489121 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,9 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +74,7 @@ def build_list_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -93,7 +100,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -111,7 +120,7 @@ def build_get_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -177,8 +186,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -205,7 +216,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -221,7 +232,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -229,13 +240,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RecoveryPointResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -248,7 +259,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints" + } @distributed_trace def get( @@ -296,8 +309,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RecoveryPointResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -313,9 +328,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -332,4 +347,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py index b549290a7ade..a17c8cbf93a0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,8 +53,10 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +73,7 @@ def build_list_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -219,9 +226,11 @@ def list( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -257,7 +266,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -273,7 +282,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -281,13 +290,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RecoveryPointResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -300,4 +309,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py index d3715d1164c1..8f395cb38a4c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,7 +47,9 @@ def build_get_operation_status_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +64,7 @@ def build_get_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -74,8 +81,10 @@ def build_bms_prepare_data_move_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +98,7 @@ def build_bms_prepare_data_move_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +117,10 @@ def build_bms_trigger_data_move_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -123,7 +134,7 @@ def build_bms_trigger_data_move_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -149,8 +160,10 @@ def build_move_recovery_point_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -168,7 +181,7 @@ def build_move_recovery_point_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -181,7 +194,7 @@ def build_move_recovery_point_request( return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -class RecoveryServicesBackupClientOperationsMixin(MixinABC): +class RecoveryServicesBackupClientOperationsMixin(RecoveryServicesBackupClientMixinABC): @distributed_trace def get_operation_status( self, vault_name: str, resource_group_name: str, operation_id: str, **kwargs: Any @@ -211,8 +224,10 @@ def get_operation_status( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_operation_status_request( vault_name=vault_name, @@ -225,9 +240,9 @@ def get_operation_status( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -245,7 +260,9 @@ def get_operation_status( return deserialized - get_operation_status.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}"} # type: ignore + get_operation_status.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}" + } def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements self, @@ -265,9 +282,11 @@ def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -290,9 +309,9 @@ def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -306,7 +325,9 @@ def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _bms_prepare_data_move_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + _bms_prepare_data_move_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove" + } @overload def begin_bms_prepare_data_move( @@ -414,12 +435,14 @@ def begin_bms_prepare_data_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._bms_prepare_data_move_initial( # type: ignore vault_name=vault_name, @@ -439,7 +462,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -451,9 +474,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_bms_prepare_data_move.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore + begin_bms_prepare_data_move.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove" + } def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements self, @@ -473,9 +498,11 @@ def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -498,9 +525,9 @@ def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-state params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -514,7 +541,9 @@ def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, {}) - _bms_trigger_data_move_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + _bms_trigger_data_move_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove" + } @overload def begin_bms_trigger_data_move( @@ -622,12 +651,14 @@ def begin_bms_trigger_data_move( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._bms_trigger_data_move_initial( # type: ignore vault_name=vault_name, @@ -647,7 +678,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -659,9 +690,11 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_bms_trigger_data_move.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore + begin_bms_trigger_data_move.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove" + } def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements self, @@ -685,9 +718,11 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -714,9 +749,9 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -729,7 +764,9 @@ def _move_recovery_point_initial( # pylint: disable=inconsistent-return-stateme if cls: return cls(pipeline_response, None, {}) - _move_recovery_point_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + _move_recovery_point_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move" + } @overload def begin_move_recovery_point( @@ -881,12 +918,14 @@ def begin_move_recovery_point( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._move_recovery_point_initial( # type: ignore vault_name=vault_name, @@ -910,7 +949,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -922,6 +961,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_move_recovery_point.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore + begin_move_recovery_point.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py index 30d86ae135ca..9f5508b25109 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +61,7 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -105,8 +112,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResourceList] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardProxyBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -129,7 +138,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -145,7 +154,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -153,13 +162,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ResourceGuardProxyBaseResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -172,4 +181,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py index 35fac08766c5..9d6285656b48 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request( "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -72,8 +79,10 @@ def build_put_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +97,7 @@ def build_put_request( "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,7 +116,9 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -122,7 +133,7 @@ def build_delete_request( "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -139,8 +150,10 @@ def build_unlock_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -155,7 +168,7 @@ def build_unlock_delete_request( "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -216,8 +229,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -230,9 +245,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -249,7 +264,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } @overload def put( @@ -357,9 +374,11 @@ def put( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGuardProxyBaseResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -383,9 +402,9 @@ def put( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -402,7 +421,9 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -433,8 +454,10 @@ def delete( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( vault_name=vault_name, @@ -447,9 +470,9 @@ def delete( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -462,7 +485,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}" + } @overload def unlock_delete( @@ -566,9 +591,11 @@ def unlock_delete( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.UnlockDeleteResponse] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.UnlockDeleteResponse] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -592,9 +619,9 @@ def unlock_delete( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -611,4 +638,6 @@ def unlock_delete( return deserialized - unlock_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore + unlock_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py index 616120229886..e7356d955302 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -49,8 +54,10 @@ def build_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -68,7 +75,7 @@ def build_trigger_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -122,9 +129,11 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -151,9 +160,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -166,7 +175,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + _trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore" + } @overload def begin_trigger( @@ -319,12 +330,14 @@ def begin_trigger( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._trigger_initial( # type: ignore vault_name=vault_name, @@ -348,7 +361,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -360,6 +373,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore + begin_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py index 6a7a67dd7d6f..c51fd9aeb3db 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,10 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +60,7 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -178,9 +185,11 @@ def get( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.TokenInformation] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TokenInformation] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -206,9 +215,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -225,4 +234,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py index 1e5dd22a65aa..cc3e17603e1f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -27,8 +28,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -42,8 +47,10 @@ def build_trigger_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -57,7 +64,7 @@ def build_trigger_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -107,9 +114,11 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -132,9 +141,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -147,7 +156,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + _trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation" + } @overload def begin_trigger( @@ -260,12 +271,14 @@ def begin_trigger( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._trigger_initial( # type: ignore vault_name=vault_name, @@ -285,7 +298,7 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) # type: PollingMethod + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -297,6 +310,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore + begin_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py index 4b67715ddd84..1b78aae6b75b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -116,8 +123,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[Optional[_models.ValidateOperationsResponse]] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.ValidateOperationsResponse]] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -130,9 +139,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -151,4 +160,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py index cc500b57ff3a..4af8b2afbc49 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -25,8 +26,12 @@ from .. import models as _models from .._serialization import Serializer -from .._vendor import MixinABC, _convert_request, _format_url_section +from .._vendor import RecoveryServicesBackupClientMixinABC, _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,9 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2022-09-01-preview") + ) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -55,7 +62,7 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -119,8 +126,10 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2022-09-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -133,9 +142,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -152,4 +161,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py index 448b2d35b56a..afc47936376d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/__init__.py @@ -13,12 +13,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["RecoveryServicesBackupPassiveClient"] +__all__ = [ + "RecoveryServicesBackupPassiveClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py index c82a5eaf3b4e..8b536db3ee83 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from ._version import VERSION +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 azure.core.credentials import TokenCredential @@ -36,7 +42,7 @@ class RecoveryServicesBackupPassiveClientConfiguration(Configuration): # pylint def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesBackupPassiveClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-11-15") # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", "2021-11-15") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -50,10 +56,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs kwargs.setdefault("sdk_moniker", "mgmt-recoveryservicesbackup/{}".format(VERSION)) self._configure(**kwargs) - def _configure( - self, **kwargs # type: Any - ): - # type: (...) -> None + def _configure(self, **kwargs: Any) -> None: self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py index 3582f46e5533..daa6e0e850eb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py @@ -12,7 +12,7 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import RecoveryServicesBackupPassiveClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( @@ -95,7 +95,7 @@ def __init__( ) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False @@ -149,15 +149,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy.url = self._client.format_url(request_copy.url) return self._client.send_request(request_copy, **kwargs) - def close(self): - # type: () -> None + def close(self) -> None: self._client.close() - def __enter__(self): - # type: () -> RecoveryServicesBackupPassiveClient + def __enter__(self) -> "RecoveryServicesBackupPassiveClient": self._client.__enter__() return self - def __exit__(self, *exc_details): - # type: (Any) -> None + def __exit__(self, *exc_details) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py index 7c1dedb5133d..2c170e28dbca 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_serialization.py @@ -25,6 +25,7 @@ # -------------------------------------------------------------------------- # pylint: skip-file +# pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode import calendar @@ -37,24 +38,22 @@ import re import sys import codecs +from typing import Optional, Union, AnyStr, IO, Mapping try: from urllib import quote # type: ignore except ImportError: - from urllib.parse import quote # type: ignore + from urllib.parse import quote import xml.etree.ElementTree as ET -import isodate +import isodate # type: ignore -from typing import Dict, Any, cast, TYPE_CHECKING +from typing import Dict, Any, cast from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -if TYPE_CHECKING: - from typing import Optional, Union, AnyStr, IO, Mapping - class RawDeserializer: @@ -65,8 +64,7 @@ class RawDeserializer: CONTEXT_NAME = "deserialized_data" @classmethod - def deserialize_from_text(cls, data, content_type=None): - # type: (Optional[Union[AnyStr, IO]], Optional[str]) -> Any + def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: Optional[str] = None) -> Any: """Decode data according to content-type. Accept a stream of data as well, but will be load at once in memory for now. @@ -132,8 +130,7 @@ def _json_attemp(data): raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod - def deserialize_from_http_generics(cls, body_bytes, headers): - # type: (Optional[Union[AnyStr, IO]], Mapping) -> Any + def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], headers: Mapping) -> Any: """Deserialize from HTTP response. Use bytes and headers to NOT use any requests/aiohttp or whatever @@ -160,8 +157,8 @@ def deserialize_from_http_generics(cls, body_bytes, headers): basestring # type: ignore unicode_str = unicode # type: ignore except NameError: - basestring = str # type: ignore - unicode_str = str # type: ignore + basestring = str + unicode_str = str _LOGGER = logging.getLogger(__name__) @@ -188,7 +185,7 @@ def dst(self, dt): try: - from datetime import timezone as _FixedOffset + from datetime import timezone as _FixedOffset # type: ignore except ImportError: # Python 2.7 class _FixedOffset(datetime.tzinfo): # type: ignore @@ -219,7 +216,7 @@ def __getinitargs__(self): try: from datetime import timezone - TZ_UTC = timezone.utc # type: ignore + TZ_UTC = timezone.utc except ImportError: TZ_UTC = UTC() # type: ignore @@ -276,9 +273,9 @@ class Model(object): serialization and deserialization. """ - _subtype_map = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - _validation = {} # type: Dict[str, Dict[str, Any]] + _subtype_map: Dict[str, Dict[str, Any]] = {} + _attribute_map: Dict[str, Dict[str, Any]] = {} + _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs): self.additional_properties = {} @@ -310,7 +307,7 @@ def enable_additional_properties_sending(cls): @classmethod def is_xml_model(cls): try: - cls._xml_map + cls._xml_map # type: ignore except AttributeError: return False return True @@ -319,7 +316,7 @@ def is_xml_model(cls): def _create_xml_node(cls): """Create XML node.""" try: - xml_map = cls._xml_map + xml_map = cls._xml_map # type: ignore except AttributeError: xml_map = {} @@ -453,7 +450,7 @@ def _classify(cls, response, objects): return cls flatten_mapping_type = cls._flatten_subtype(subtype_key, objects) try: - return objects[flatten_mapping_type[subtype_value]] + return objects[flatten_mapping_type[subtype_value]] # type: ignore except KeyError: _LOGGER.warning( "Subtype value %s has no mapping, use base class %s.", @@ -606,13 +603,13 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if xml_ns: ET.register_namespace(xml_prefix, xml_ns) xml_name = "{}{}".format(xml_ns, xml_name) - serialized.set(xml_name, new_attr) + serialized.set(xml_name, new_attr) # type: ignore continue if xml_desc.get("text", False): - serialized.text = new_attr + serialized.text = new_attr # type: ignore continue if isinstance(new_attr, list): - serialized.extend(new_attr) + serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): @@ -621,23 +618,23 @@ def _serialize(self, target_obj, data_type=None, **kwargs): new_attr.tag = "}".join([splitted_tag[0], xml_name]) else: new_attr.tag = xml_name - serialized.append(new_attr) + serialized.append(new_attr) # type: ignore 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) - serialized.append(local_node) + serialized.append(local_node) # type: ignore else: # JSON - for k in reversed(keys): + for k in reversed(keys): # type: ignore unflattened = {k: new_attr} new_attr = unflattened _new_attr = new_attr _serialized = serialized - for k in keys: + for k in keys: # type: ignore if k not in _serialized: - _serialized.update(_new_attr) - _new_attr = _new_attr[k] + _serialized.update(_new_attr) # type: ignore + _new_attr = _new_attr[k] # type: ignore _serialized = _serialized[k] except ValueError: continue @@ -675,7 +672,7 @@ def body(self, data, data_type, **kwargs): # We're not able to deal with additional properties for now. deserializer.additional_properties_detection = False if is_xml_model_serialization: - deserializer.key_extractors = [ + deserializer.key_extractors = [ # type: ignore attribute_key_case_insensitive_extractor, ] else: @@ -843,7 +840,7 @@ def serialize_unicode(cls, data): pass try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore # Don't change it, JSON and XML ElementTree are totally able # to serialize correctly u'' strings return data @@ -1001,10 +998,10 @@ def serialize_enum(attr, enum_obj=None): except AttributeError: result = attr try: - enum_obj(result) + enum_obj(result) # type: ignore return result except ValueError: - for enum_value in enum_obj: + for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" @@ -1416,7 +1413,7 @@ def _deserialize(self, target_obj, data): if data is None: return data try: - attributes = response._attribute_map + attributes = response._attribute_map # type: ignore d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1444,7 +1441,7 @@ def _deserialize(self, target_obj, data): value = self.deserialize_data(raw_value, attr_desc["type"]) d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: - msg = "Unable to deserialize to object: " + class_name + msg = "Unable to deserialize to object: " + class_name # type: ignore raise_with_traceback(DeserializationError, msg, err) else: additional_properties = self._build_additional_properties(attributes, data) @@ -1543,7 +1540,7 @@ def _unpack_content(raw_data, content_type=None): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): - return RawDeserializer.deserialize_from_text(raw_data, content_type) + return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data def _instantiate_model(self, response, attrs, additional_properties=None): @@ -1565,7 +1562,7 @@ def _instantiate_model(self, response, attrs, additional_properties=None): response_obj.additional_properties = additional_properties return response_obj except TypeError as err: - msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) + msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore raise DeserializationError(msg + str(err)) else: try: @@ -1747,7 +1744,7 @@ def deserialize_unicode(data): # Consider this is real string try: - if isinstance(data, unicode): + if isinstance(data, unicode): # type: ignore return data except NameError: return str(data) @@ -1798,7 +1795,7 @@ def deserialize_bytearray(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return bytearray(b64decode(attr)) + return bytearray(b64decode(attr)) # type: ignore @staticmethod def deserialize_base64(attr): @@ -1810,8 +1807,8 @@ def deserialize_base64(attr): """ if isinstance(attr, ET.Element): attr = attr.text - padding = "=" * (3 - (len(attr) + 3) % 4) - attr = attr + padding + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore encoded = attr.replace("-", "+").replace("_", "/") return b64decode(encoded) @@ -1826,7 +1823,7 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) + return decimal.Decimal(attr) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) raise_with_traceback(DeserializationError, msg, err) @@ -1841,7 +1838,7 @@ def deserialize_long(attr): """ if isinstance(attr, ET.Element): attr = attr.text - return _long_type(attr) + return _long_type(attr) # type: ignore @staticmethod def deserialize_duration(attr): @@ -1871,7 +1868,7 @@ def deserialize_date(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + 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) @@ -1886,7 +1883,7 @@ def deserialize_time(attr): """ if isinstance(attr, ET.Element): attr = attr.text - if re.search(r"[^\W\d_]", attr, re.I + re.U): + if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) return isodate.parse_time(attr) @@ -1901,7 +1898,7 @@ def deserialize_rfc(attr): if isinstance(attr, ET.Element): attr = attr.text try: - parsed_date = email.utils.parsedate_tz(attr) + parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) @@ -1924,7 +1921,7 @@ def deserialize_iso(attr): if isinstance(attr, ET.Element): attr = attr.text try: - attr = attr.upper() + attr = attr.upper() # type: ignore match = Deserializer.valid_date.match(attr) if not match: raise ValueError("Invalid datetime string: " + attr) @@ -1960,7 +1957,7 @@ def deserialize_unix(attr): :raises: DeserializationError if format invalid """ if isinstance(attr, ET.Element): - attr = int(attr.text) + attr = int(attr.text) # type: ignore try: date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py index 96ddf058f512..e5754a47ce68 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "5.1.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py index b0c9e9eacd21..839d85e2e381 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/__init__.py @@ -10,12 +10,14 @@ try: from ._patch import __all__ as _patch_all - from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk -__all__ = ["RecoveryServicesBackupPassiveClient"] +__all__ = [ + "RecoveryServicesBackupPassiveClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py index 6269cd3efc88..75bd2ef83282 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py @@ -6,6 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration @@ -14,6 +15,11 @@ from .._version import VERSION +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 azure.core.credentials_async import AsyncTokenCredential @@ -36,7 +42,7 @@ class RecoveryServicesBackupPassiveClientConfiguration(Configuration): # pylint def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(RecoveryServicesBackupPassiveClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2021-11-15") # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", "2021-11-15") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py index 439b1564f711..f19553db3162 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py @@ -12,7 +12,7 @@ from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from .. import models +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import RecoveryServicesBackupPassiveClientConfiguration from .operations import ( @@ -95,7 +95,7 @@ def __init__( ) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) - client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py index cc07a4210734..2fc83cfb6d5a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/__init__.py @@ -19,7 +19,7 @@ from ._backup_protected_items_crr_operations import BackupProtectedItemsCrrOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py index bcca4e613a1a..fe0a20fb236d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._aad_properties_operations import build_get_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -78,8 +83,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AADPropertiesResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AADPropertiesResource] = kwargs.pop("cls", None) request = build_get_request( azure_region=azure_region, @@ -91,9 +98,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -111,4 +118,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py index 1abba25c3415..c6a73777786d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._backup_crr_job_details_operations import build_get_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -128,9 +133,11 @@ async def get( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -152,9 +159,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -172,4 +179,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py index a379de27cfbb..ba74f02d42af 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._backup_crr_jobs_operations import build_list_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -151,9 +156,11 @@ def list( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResourceList] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -187,7 +194,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -203,7 +210,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -211,13 +218,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("JobResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -231,4 +238,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py index 41e05b9c93cf..e26a1dd57b0d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._backup_protected_items_crr_operations import build_list_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResourceList] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectedItemResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +115,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +131,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +139,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ProtectedItemResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -152,4 +159,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py index ecca69d8cd15..acc7d3e6a2d0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -31,6 +32,10 @@ build_update_request, ) +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -81,8 +86,10 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupResourceConfigResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -94,9 +101,9 @@ async def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -114,7 +121,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } @overload async def update( @@ -210,9 +219,11 @@ async def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupResourceConfigResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -235,9 +246,9 @@ async def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -255,7 +266,9 @@ async def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } @overload async def patch( # pylint: disable=inconsistent-return-statements @@ -351,9 +364,11 @@ async def patch( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -376,9 +391,9 @@ async def patch( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -392,4 +407,6 @@ async def patch( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - patch.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py index f8ac66092359..d43fb52287ef 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._backup_usage_summaries_crr_operations import build_list_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,8 +87,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupManagementUsageList] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupManagementUsageList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -108,7 +115,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -124,7 +131,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -132,13 +139,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupManagementUsageList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -152,4 +159,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py index 3433497321d4..e4dbb1fc0c8e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._cross_region_restore_operations import build_trigger_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,9 +71,11 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -90,9 +97,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -106,7 +113,9 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore + _trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore" + } @overload async def begin_trigger( @@ -208,12 +217,14 @@ async def begin_trigger( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._trigger_initial( # type: ignore azure_region=azure_region, @@ -232,10 +243,10 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -247,6 +258,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore + begin_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py index 291fdc4a802a..78219de94f59 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._crr_operation_results_operations import build_get_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -76,8 +81,10 @@ async def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_request( azure_region=azure_region, @@ -89,9 +96,9 @@ async def get( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -105,4 +112,6 @@ async def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py index 354710bd1890..61dd537a78bc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._crr_operation_status_operations import build_get_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -74,8 +79,10 @@ async def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _mod _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( azure_region=azure_region, @@ -87,9 +94,9 @@ async def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _mod params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -107,4 +114,6 @@ async def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _mod return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py index 71a22d238d64..6d9d16a3dbdf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._recovery_points_crr_operations import build_list_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -88,8 +93,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,7 +123,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -132,7 +139,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -140,13 +147,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("RecoveryPointResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -160,4 +167,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py index 2cf3bf5bb936..06c21e96423c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._recovery_points_operations import build_get_access_token_request +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -186,9 +191,11 @@ async def get_access_token( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CrrAccessTokenResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CrrAccessTokenResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -215,9 +222,9 @@ async def get_access_token( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -235,4 +242,6 @@ async def get_access_token( return deserialized - get_access_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken"} # type: ignore + get_access_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py index 1536b2168d82..4d165128ead5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/__init__.py @@ -159,7 +159,7 @@ from ._recovery_services_backup_passive_client_enums import UsagesUnit from ._recovery_services_backup_passive_client_enums import WorkloadType from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py index e36298d0b708..9bc95a4e0c05 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/models/_models_py3.py @@ -344,7 +344,7 @@ def __init__( :paramtype resource_guard_operation_requests: list[str] """ super().__init__(**kwargs) - self.protected_item_type = None # type: Optional[str] + self.protected_item_type: Optional[str] = None self.backup_management_type = backup_management_type self.workload_type = workload_type self.container_name = container_name @@ -574,7 +574,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.protected_item_type = "AzureFileShareProtectedItem" # type: str + self.protected_item_type: str = "AzureFileShareProtectedItem" self.friendly_name = friendly_name self.protection_status = protection_status self.protection_state = protection_state @@ -677,7 +677,7 @@ class RecoveryPoint(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureFileShareRecoveryPoint(RecoveryPoint): @@ -720,7 +720,7 @@ class AzureFileShareRecoveryPoint(RecoveryPoint): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = "AzureFileShareRecoveryPoint" # type: str + self.object_type: str = "AzureFileShareRecoveryPoint" self.recovery_point_type = None self.recovery_point_time = None self.file_share_snapshot_uri = None @@ -759,7 +759,7 @@ class RestoreRequest(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureFileShareRestoreRequest(RestoreRequest): @@ -842,7 +842,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.passivestamp.models.TargetAFSRestoreInfo """ super().__init__(**kwargs) - self.object_type = "AzureFileShareRestoreRequest" # type: str + self.object_type: str = "AzureFileShareRestoreRequest" self.recovery_type = recovery_type self.source_resource_id = source_resource_id self.copy_options = copy_options @@ -1104,7 +1104,7 @@ def __init__( # pylint: disable=too-many-locals resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.protected_item_type = "AzureIaaSVMProtectedItem" # type: str + self.protected_item_type: str = "AzureIaaSVMProtectedItem" self.friendly_name = friendly_name self.virtual_machine_id = virtual_machine_id self.protection_status = protection_status @@ -1374,7 +1374,7 @@ def __init__( # pylint: disable=too-many-locals extended_properties=extended_properties, **kwargs ) - self.protected_item_type = "Microsoft.ClassicCompute/virtualMachines" # type: str + self.protected_item_type: str = "Microsoft.ClassicCompute/virtualMachines" class AzureIaaSComputeVMProtectedItem(AzureIaaSVMProtectedItem): # pylint: disable=too-many-instance-attributes @@ -1632,7 +1632,7 @@ def __init__( # pylint: disable=too-many-locals extended_properties=extended_properties, **kwargs ) - self.protected_item_type = "Microsoft.Compute/virtualMachines" # type: str + self.protected_item_type: str = "Microsoft.Compute/virtualMachines" class AzureIaaSVMErrorInfo(_serialization.Model): @@ -1840,7 +1840,7 @@ def __init__( self.start_time = start_time self.end_time = end_time self.activity_id = activity_id - self.job_type = None # type: Optional[str] + self.job_type: Optional[str] = None class AzureIaaSVMJob(Job): # pylint: disable=too-many-instance-attributes @@ -1965,7 +1965,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "AzureIaaSVMJob" # type: str + self.job_type: str = "AzureIaaSVMJob" self.duration = duration self.actions_info = actions_info self.error_details = error_details @@ -2333,7 +2333,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.protected_item_type = "Microsoft.Sql/servers/databases" # type: str + self.protected_item_type: str = "Microsoft.Sql/servers/databases" self.protected_item_data_id = protected_item_data_id self.protection_state = protection_state self.extended_info = extended_info @@ -2546,7 +2546,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "AzureStorageJob" # type: str + self.job_type: str = "AzureStorageJob" self.duration = duration self.actions_info = actions_info self.error_details = error_details @@ -2887,7 +2887,7 @@ def __init__( # pylint: disable=too-many-locals resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.protected_item_type = "AzureVmWorkloadProtectedItem" # type: str + self.protected_item_type: str = "AzureVmWorkloadProtectedItem" self.friendly_name = friendly_name self.server_name = server_name self.parent_name = parent_name @@ -3212,7 +3212,7 @@ def __init__( # pylint: disable=too-many-locals kpis_healths=kpis_healths, **kwargs ) - self.protected_item_type = "AzureVmWorkloadSAPAseDatabase" # type: str + self.protected_item_type: str = "AzureVmWorkloadSAPAseDatabase" class AzureVmWorkloadSAPHanaDatabaseProtectedItem( @@ -3483,7 +3483,7 @@ def __init__( # pylint: disable=too-many-locals kpis_healths=kpis_healths, **kwargs ) - self.protected_item_type = "AzureVmWorkloadSAPHanaDatabase" # type: str + self.protected_item_type: str = "AzureVmWorkloadSAPHanaDatabase" class AzureVmWorkloadSQLDatabaseProtectedItem( @@ -3754,7 +3754,7 @@ def __init__( # pylint: disable=too-many-locals kpis_healths=kpis_healths, **kwargs ) - self.protected_item_type = "AzureVmWorkloadSQLDatabase" # type: str + self.protected_item_type: str = "AzureVmWorkloadSQLDatabase" class AzureWorkloadErrorInfo(_serialization.Model): @@ -3930,7 +3930,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "AzureWorkloadJob" # type: str + self.job_type: str = "AzureWorkloadJob" self.workload_type = workload_type self.duration = duration self.actions_info = actions_info @@ -4073,7 +4073,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointMoveReadinessInfo] """ super().__init__(**kwargs) - self.object_type = "AzureWorkloadRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadRecoveryPoint" self.recovery_point_time_in_utc = None self.type = None self.recovery_point_tier_details = recovery_point_tier_details @@ -4155,7 +4155,7 @@ def __init__( recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs ) - self.object_type = "AzureWorkloadPointInTimeRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadPointInTimeRecoveryPoint" self.time_ranges = time_ranges @@ -4248,7 +4248,7 @@ def __init__( :paramtype target_virtual_machine_id: str """ super().__init__(**kwargs) - self.object_type = "AzureWorkloadRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadRestoreRequest" self.recovery_type = recovery_type self.source_resource_id = source_resource_id self.property_bag = property_bag @@ -4348,7 +4348,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadPointInTimeRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadPointInTimeRestoreRequest" self.point_in_time = point_in_time @@ -4421,7 +4421,7 @@ def __init__( time_ranges=time_ranges, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadSAPHanaPointInTimeRecoveryPoint" class AzureWorkloadSAPHanaRestoreRequest(AzureWorkloadRestoreRequest): @@ -4518,7 +4518,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadSAPHanaRestoreRequest" class AzureWorkloadSAPHanaPointInTimeRestoreRequest(AzureWorkloadSAPHanaRestoreRequest): @@ -4612,7 +4612,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadSAPHanaPointInTimeRestoreRequest" self.point_in_time = point_in_time @@ -4676,7 +4676,7 @@ def __init__( recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs ) - self.object_type = "AzureWorkloadSAPHanaRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadSAPHanaRecoveryPoint" class AzureWorkloadSQLRecoveryPoint(AzureWorkloadRecoveryPoint): @@ -4760,7 +4760,7 @@ def __init__( recovery_point_move_readiness_info=recovery_point_move_readiness_info, **kwargs ) - self.object_type = "AzureWorkloadSQLRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadSQLRecoveryPoint" self.extended_info = extended_info @@ -4847,7 +4847,7 @@ def __init__( extended_info=extended_info, **kwargs ) - self.object_type = "AzureWorkloadSQLPointInTimeRecoveryPoint" # type: str + self.object_type: str = "AzureWorkloadSQLPointInTimeRecoveryPoint" self.time_ranges = time_ranges @@ -4967,7 +4967,7 @@ def __init__( target_virtual_machine_id=target_virtual_machine_id, **kwargs ) - self.object_type = "AzureWorkloadSQLRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadSQLRestoreRequest" self.should_use_alternate_target_location = should_use_alternate_target_location self.is_non_recoverable = is_non_recoverable self.alternate_directory_paths = alternate_directory_paths @@ -5093,7 +5093,7 @@ def __init__( alternate_directory_paths=alternate_directory_paths, **kwargs ) - self.object_type = "AzureWorkloadSQLPointInTimeRestoreRequest" # type: str + self.object_type: str = "AzureWorkloadSQLPointInTimeRestoreRequest" self.point_in_time = point_in_time @@ -5828,7 +5828,7 @@ def __init__( # pylint: disable=too-many-locals :paramtype b_ms_active_region: str """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None self.access_token_string = access_token_string self.subscription_id = subscription_id self.resource_group_name = resource_group_name @@ -6224,7 +6224,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "DpmJob" # type: str + self.job_type: str = "DpmJob" self.duration = duration self.dpm_server_name = dpm_server_name self.container_name = container_name @@ -6512,7 +6512,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.protected_item_type = "DPMProtectedItem" # type: str + self.protected_item_type: str = "DPMProtectedItem" self.friendly_name = friendly_name self.backup_engine_name = backup_engine_name self.protection_state = protection_state @@ -6970,7 +6970,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.protected_item_type = "GenericProtectedItem" # type: str + self.protected_item_type: str = "GenericProtectedItem" self.friendly_name = friendly_name self.policy_state = policy_state self.protection_state = protection_state @@ -7030,7 +7030,7 @@ def __init__( :paramtype recovery_point_additional_info: str """ super().__init__(**kwargs) - self.object_type = "GenericRecoveryPoint" # type: str + self.object_type: str = "GenericRecoveryPoint" self.friendly_name = friendly_name self.recovery_point_type = recovery_point_type self.recovery_point_time = recovery_point_time @@ -7166,7 +7166,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointMoveReadinessInfo] """ super().__init__(**kwargs) - self.object_type = "IaasVMRecoveryPoint" # type: str + self.object_type: str = "IaasVMRecoveryPoint" self.recovery_point_type = None self.recovery_point_time = None self.recovery_point_additional_info = None @@ -7377,7 +7377,7 @@ def __init__( ~azure.mgmt.recoveryservicesbackup.passivestamp.models.IdentityBasedRestoreDetails """ super().__init__(**kwargs) - self.object_type = "IaasVMRestoreRequest" # type: str + self.object_type: str = "IaasVMRestoreRequest" self.recovery_point_id = recovery_point_id self.recovery_type = recovery_type self.source_resource_id = source_resource_id @@ -8021,7 +8021,7 @@ def __init__( resource_guard_operation_requests=resource_guard_operation_requests, **kwargs ) - self.protected_item_type = "MabFileFolderProtectedItem" # type: str + self.protected_item_type: str = "MabFileFolderProtectedItem" self.friendly_name = friendly_name self.computer_name = computer_name self.last_backup_status = last_backup_status @@ -8218,7 +8218,7 @@ def __init__( activity_id=activity_id, **kwargs ) - self.job_type = "MabJob" # type: str + self.job_type: str = "MabJob" self.duration = duration self.actions_info = actions_info self.mab_server_name = mab_server_name @@ -8545,7 +8545,7 @@ class OperationStatusExtendedInfo(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class OperationStatusJobExtendedInfo(OperationStatusExtendedInfo): @@ -8575,7 +8575,7 @@ def __init__(self, *, job_id: Optional[str] = None, **kwargs): :paramtype job_id: str """ super().__init__(**kwargs) - self.object_type = "OperationStatusJobExtendedInfo" # type: str + self.object_type: str = "OperationStatusJobExtendedInfo" self.job_id = job_id @@ -8614,7 +8614,7 @@ def __init__( :paramtype failed_jobs_error: dict[str, str] """ super().__init__(**kwargs) - self.object_type = "OperationStatusJobsExtendedInfo" # type: str + self.object_type: str = "OperationStatusJobsExtendedInfo" self.job_ids = job_ids self.failed_jobs_error = failed_jobs_error @@ -8648,7 +8648,7 @@ def __init__(self, *, recovery_target: Optional["_models.InstantItemRecoveryTarg ~azure.mgmt.recoveryservicesbackup.passivestamp.models.InstantItemRecoveryTarget """ super().__init__(**kwargs) - self.object_type = "OperationStatusProvisionILRExtendedInfo" # type: str + self.object_type: str = "OperationStatusProvisionILRExtendedInfo" self.recovery_target = recovery_target @@ -8694,7 +8694,7 @@ def __init__( :paramtype deleted_backup_item_version: str """ super().__init__(**kwargs) - self.object_type = "OperationStatusRecoveryPointExtendedInfo" # type: str + self.object_type: str = "OperationStatusRecoveryPointExtendedInfo" self.updated_recovery_point = updated_recovery_point self.deleted_backup_item_version = deleted_backup_item_version @@ -9615,7 +9615,7 @@ def __init__( # pylint: disable=too-many-locals b_ms_active_region=b_ms_active_region, **kwargs ) - self.object_type = "WorkloadCrrAccessToken" # type: str + self.object_type: str = "WorkloadCrrAccessToken" self.protectable_object_unique_name = protectable_object_unique_name self.protectable_object_friendly_name = protectable_object_friendly_name self.protectable_object_workload_type = protectable_object_workload_type diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py index cc07a4210734..2fc83cfb6d5a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/__init__.py @@ -19,7 +19,7 @@ from ._backup_protected_items_crr_operations import BackupProtectedItemsCrrOperations from ._patch import __all__ as _patch_all -from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py index 9aae6ca5aa52..b3629645e8f4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +45,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -53,7 +58,7 @@ def build_get_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -111,8 +116,10 @@ def get(self, azure_region: str, filter: Optional[str] = None, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.AADPropertiesResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AADPropertiesResource] = kwargs.pop("cls", None) request = build_get_request( azure_region=azure_region, @@ -124,9 +131,9 @@ def get(self, azure_region: str, filter: Optional[str] = None, **kwargs: Any) -> params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -144,4 +151,6 @@ def get(self, azure_region: str, filter: Optional[str] = None, **kwargs: Any) -> return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py index ef2a207381dd..67bda9999e6c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,8 +43,8 @@ def build_get_request(azure_region: str, subscription_id: str, **kwargs: Any) -> _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(azure_region: str, subscription_id: str, **kwargs: Any) -> "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -162,9 +167,11 @@ def get( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -186,9 +193,9 @@ def get( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -206,4 +213,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py index a4e3536c3185..4223d268f1c5 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,8 +52,8 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -61,7 +66,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -196,9 +201,11 @@ def list( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.JobResourceList] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.JobResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -232,7 +239,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -248,7 +255,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -256,13 +263,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("JobResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -276,4 +283,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py index 6983263dd796..daf40d0c78c4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +67,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +131,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ProtectedItemResourceList] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ProtectedItemResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -152,7 +159,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -168,7 +175,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +183,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ProtectedItemResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -196,4 +203,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py index fdb9b2876202..192fe9c142b3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(vault_name: str, resource_group_name: str, subscription_id "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -67,8 +72,8 @@ def build_update_request(vault_name: str, resource_group_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -82,7 +87,7 @@ def build_update_request(vault_name: str, resource_group_name: str, subscription "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -99,8 +104,8 @@ def build_patch_request(vault_name: str, resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,7 +119,7 @@ def build_patch_request(vault_name: str, resource_group_name: str, subscription_ "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -171,8 +176,10 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupResourceConfigResource] = kwargs.pop("cls", None) request = build_get_request( vault_name=vault_name, @@ -184,9 +191,9 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -204,7 +211,9 @@ def get(self, vault_name: str, resource_group_name: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } @overload def update( @@ -300,9 +309,11 @@ def update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupResourceConfigResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.BackupResourceConfigResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -325,9 +336,9 @@ def update( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -345,7 +356,9 @@ def update( return deserialized - update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } @overload def patch( # pylint: disable=inconsistent-return-statements @@ -441,9 +454,11 @@ def patch( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -466,9 +481,9 @@ def patch( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -482,4 +497,6 @@ def patch( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - patch.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py index 8aa54586cc39..9c39326170e2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -48,7 +53,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +67,7 @@ def build_list_request( "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -126,8 +131,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.BackupManagementUsageList] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupManagementUsageList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -152,7 +159,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -168,7 +175,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -176,13 +183,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupManagementUsageList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -196,4 +203,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py index 34b9abd8c3ed..f8785347496e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,8 +45,8 @@ def build_trigger_request(azure_region: str, subscription_id: str, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -54,7 +59,7 @@ def build_trigger_request(azure_region: str, subscription_id: str, **kwargs: Any "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -100,9 +105,11 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -124,9 +131,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -140,7 +147,9 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore + _trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore" + } @overload def begin_trigger( @@ -242,12 +251,14 @@ def begin_trigger( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token = kwargs.pop("continuation_token", None) # type: Optional[str] + cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = self._trigger_initial( # type: ignore azure_region=azure_region, @@ -266,9 +277,9 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- return cls(pipeline_response, None, {}) if polling is True: - polling_method = cast( + polling_method: PollingMethod = cast( PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -280,6 +291,8 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - begin_trigger.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore + begin_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py index 4a1a95e11543..5ce0b2a19851 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_get_request(azure_region: str, operation_id: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(azure_region: str, operation_id: str, subscription_id: str "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -108,8 +113,10 @@ def get( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_get_request( azure_region=azure_region, @@ -121,9 +128,9 @@ def get( # pylint: disable=inconsistent-return-statements params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -137,4 +144,6 @@ def get( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py index 297546bf0d90..5cde9ac76895 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +43,7 @@ def build_get_request(azure_region: str, operation_id: str, subscription_id: str _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(azure_region: str, operation_id: str, subscription_id: str "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -106,8 +111,10 @@ def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _models.Op _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.OperationStatus] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationStatus] = kwargs.pop("cls", None) request = build_get_request( azure_region=azure_region, @@ -119,9 +126,9 @@ def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _models.Op params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -139,4 +146,6 @@ def get(self, azure_region: str, operation_id: str, **kwargs: Any) -> _models.Op return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py index f1c036bda44f..c9f444eb1a7a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +55,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -67,7 +72,7 @@ def build_list_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -135,8 +140,10 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.RecoveryPointResourceList] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.RecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -163,7 +170,7 @@ def prepare_request(next_link=None): params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version @@ -179,7 +186,7 @@ def prepare_request(next_link=None): "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) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -187,13 +194,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("RecoveryPointResourceList", pipeline_response) list_of_elem = deserialized.value if cls: - list_of_elem = cls(list_of_elem) + list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) response = pipeline_response.http_response @@ -207,4 +214,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py index 18acfbe9bebf..1374497471c1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py @@ -6,6 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload from azure.core.exceptions import ( @@ -27,6 +28,10 @@ from .._serialization import Serializer from .._vendor import _convert_request, _format_url_section +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 T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -47,8 +52,8 @@ def build_get_access_token_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] + api_version: Literal["2021-11-15"] = kwargs.pop("api_version", _params.pop("api-version", "2021-11-15")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -66,7 +71,7 @@ def build_get_access_token_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, "str"), } - _url = _format_url_section(_url, **path_format_arguments) + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -234,9 +239,11 @@ def get_access_token( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - content_type = kwargs.pop("content_type", _headers.pop("Content-Type", None)) # type: Optional[str] - cls = kwargs.pop("cls", None) # type: ClsType[_models.CrrAccessTokenResource] + api_version: Literal["2021-11-15"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CrrAccessTokenResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -263,9 +270,9 @@ def get_access_token( params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -283,4 +290,6 @@ def get_access_token( return deserialized - get_access_token.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken"} # type: ignore + get_access_token.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken" + } diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_aad_properties_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_aad_properties_get.py new file mode 100644 index 000000000000..31f9df07ef98 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_aad_properties_get.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_aad_properties_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.aad_properties.get( + azure_region="southeastasia", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/BackupAadProperties_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_data_move_operation_status_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_data_move_operation_status_get.py new file mode 100644 index 000000000000..9ff83b75dcb0 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_data_move_operation_status_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_data_move_operation_status_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.get_operation_status( + vault_name="source-rsv", + resource_group_name="sourceRG", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/BackupDataMove/BackupDataMoveOperationStatus_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_engines_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_engines_get.py new file mode 100644 index 000000000000..b0339246034a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_engines_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_engines_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_engines.get( + vault_name="testVault", + resource_group_name="testRG", + backup_engine_name="testServer", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Dpm/BackupEngines_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_engines_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_engines_list.py new file mode 100644 index 000000000000..b7a13d971d22 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_engines_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_engines_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_engines.list( + vault_name="testVault", + resource_group_name="testRG", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Dpm/BackupEngines_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_feature_validate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_feature_validate.py new file mode 100644 index 000000000000..cfaee710845b --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_feature_validate.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_feature_validate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.feature_support.validate( + azure_region="southeastasia", + parameters={"featureType": "AzureVMResourceBackup", "vmSize": "Basic_A0", "vmSku": "Premium"}, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/BackupFeature_Validate.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_policies_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_policies_list.py new file mode 100644 index 000000000000..d1908fd415b1 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_policies_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_policies_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_policies.list( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/BackupPolicies_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protectable_items_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protectable_items_list.py new file mode 100644 index 000000000000..05bc95ced995 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protectable_items_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_protectable_items_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_protectable_items.list( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/BackupProtectableItems_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protected_item_usage_summary_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protected_item_usage_summary_get.py new file mode 100644 index 000000000000..bd1dbd8a693d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protected_item_usage_summary_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_protected_item_usage_summary_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_usage_summaries.list( + vault_name="testVault", + resource_group_name="testRG", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupProtectedItem_UsageSummary_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protected_items_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protected_items_list.py new file mode 100644 index 000000000000..a8301d5ad702 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protected_items_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_protected_items_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_protected_items.list( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/BackupProtectedItems_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_containers_usage_summary_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_containers_usage_summary_get.py new file mode 100644 index 000000000000..cd475e97852f --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_containers_usage_summary_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_protection_containers_usage_summary_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_usage_summaries.list( + vault_name="testVault", + resource_group_name="testRG", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupProtectionContainers_UsageSummary_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_delete.py new file mode 100644 index 000000000000..254309fd0af8 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_delete.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_protection_intent_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_intent.delete( + vault_name="myVault", + resource_group_name="myRG", + fabric_name="Azure", + intent_object_name="249D9B07-D2EF-4202-AA64-65F35418564E", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureWorkload/BackupProtectionIntent_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_get.py new file mode 100644 index 000000000000..27353024390a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_protection_intent_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_intent.get( + vault_name="myVault", + resource_group_name="myRG", + fabric_name="Azure", + intent_object_name="249D9B07-D2EF-4202-AA64-65F35418564E", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureWorkload/BackupProtectionIntent_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_list.py new file mode 100644 index 000000000000..40605fe453b0 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_protection_intent_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_protection_intent_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_protection_intent.list( + vault_name="myVault", + resource_group_name="myRG", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureWorkload/BackupProtectionIntent_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_encryption_config_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_encryption_config_get.py new file mode 100644 index 000000000000..49899f891262 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_encryption_config_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_resource_encryption_config_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_resource_encryption_configs.get( + vault_name="rishTestVault", + resource_group_name="rishgrp", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/BackupResourceEncryptionConfig_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_encryption_config_put.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_encryption_config_put.py new file mode 100644 index 000000000000..a769e5d96b47 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_encryption_config_put.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_resource_encryption_config_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_resource_encryption_configs.update( + vault_name="source-rsv", + resource_group_name="test-rg", + parameters={ + "properties": { + "encryptionAtRestType": "CustomerManaged", + "infrastructureEncryptionState": "true", + "keyUri": "https://gktestkv1.vault.azure.net/keys/Test1/ed2e8cdc7f86477ebf0c6462b504a9ed", + "subscriptionId": "1a2311d9-66f5-47d3-a9fb-7a37da63934b", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/BackupResourceEncryptionConfig_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_get.py new file mode 100644 index 000000000000..6d74d7d83011 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_resource_vault_configs_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_resource_vault_configs.get( + vault_name="SwaggerTest", + resource_group_name="SwaggerTestRg", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupResourceVaultConfigs_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_patch.py new file mode 100644 index 000000000000..ed7cc2bf5bfd --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_patch.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_resource_vault_configs_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_resource_vault_configs.update( + vault_name="SwaggerTest", + resource_group_name="SwaggerTestRg", + parameters={"properties": {"enhancedSecurityState": "Enabled"}}, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupResourceVaultConfigs_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_put.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_put.py new file mode 100644 index 000000000000..e282ca83070a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_resource_vault_configs_put.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_resource_vault_configs_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_resource_vault_configs.put( + vault_name="SwaggerTest", + resource_group_name="SwaggerTestRg", + parameters={"properties": {"enhancedSecurityState": "Enabled", "softDeleteFeatureState": "Enabled"}}, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupResourceVaultConfigs_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_security_pin_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_security_pin_get.py new file mode 100644 index 000000000000..0343dbebbbee --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_security_pin_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_security_pin_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.security_pins.get( + vault_name="SwaggerTest", + resource_group_name="SwaggerTestRg", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupSecurityPin_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_get.py new file mode 100644 index 000000000000..06a7c7e0d775 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_storage_config_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_resource_storage_configs_non_crr.get( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupStorageConfig_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_patch.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_patch.py new file mode 100644 index 000000000000..773acb0d0bcd --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_patch.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_storage_config_patch.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_resource_storage_configs_non_crr.patch( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + parameters={"properties": {"storageType": "LocallyRedundant", "storageTypeState": "Unlocked"}}, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupStorageConfig_Patch.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_put.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_put.py new file mode 100644 index 000000000000..2ffc1c7a5997 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_storage_config_put.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_storage_config_put.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_resource_storage_configs_non_crr.update( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + parameters={"properties": {"storageType": "LocallyRedundant", "storageTypeState": "Unlocked"}}, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/BackupStorageConfig_Put.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_workload_items_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_workload_items_list.py new file mode 100644 index 000000000000..d60c64e21766 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/backup_workload_items_list.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python backup_workload_items_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_workload_items.list( + vault_name="suchandr-seacan-rsv", + resource_group_name="testRg", + fabric_name="Azure", + container_name="VMAppContainer;Compute;bvtdtestag;sqlserver-1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureWorkload/BackupWorkloadItems_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/cancel_job_operation_result.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/cancel_job_operation_result.py new file mode 100644 index 000000000000..97ea9b8e63b6 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/cancel_job_operation_result.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python cancel_job_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.job_operation_results.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + job_name="00000000-0000-0000-0000-000000000000", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/CancelJobOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/classic_compute_protected_item_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/classic_compute_protected_item_get.py new file mode 100644 index 000000000000..c1262b91e716 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/classic_compute_protected_item_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python classic_compute_protected_item_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protected_items.get( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + fabric_name="Azure", + container_name="iaasvmcontainer;iaasvmcontainer;iaasvm-rg;iaasvm-1", + protected_item_name="vm;iaasvmcontainer;iaasvm-rg;iaasvm-1", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ClassicCompute_ProtectedItem_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/compute_protected_item_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/compute_protected_item_get.py new file mode 100644 index 000000000000..fe7a33c3465a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/compute_protected_item_get.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python compute_protected_item_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protected_items.get( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + fabric_name="Azure", + container_name="iaasvmcontainer;iaasvmcontainerv2;iaasvm-rg;iaasvm-1", + protected_item_name="vm;iaasvmcontainerv2;iaasvm-rg;iaasvm-1", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/Compute_ProtectedItem_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/configure_protection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/configure_protection.py new file mode 100644 index 000000000000..079a948826f8 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/configure_protection.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python configure_protection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protected_items.create_or_update( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + parameters={ + "properties": { + "policyId": "/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/SwaggerTestRg/providers/Microsoft.RecoveryServices/vaults/NetSDKTestRsVault/backupPolicies/DefaultPolicy", + "protectedItemType": "Microsoft.Compute/virtualMachines", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ConfigureProtection.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/delete_private_endpoint_connection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/delete_private_endpoint_connection.py new file mode 100644 index 000000000000..bbc9f765f078 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/delete_private_endpoint_connection.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python delete_private_endpoint_connection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.private_endpoint_connection.begin_delete( + vault_name="gaallavaultbvtd2msi", + resource_group_name="gaallaRG", + private_endpoint_connection_name="gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b", + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/PrivateEndpointConnection/DeletePrivateEndpointConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/delete_resource_guard_proxy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/delete_resource_guard_proxy.py new file mode 100644 index 000000000000..89fd85a3b6c6 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/delete_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python delete_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guard_proxy.delete( + vault_name="sampleVault", + resource_group_name="SampleResourceGroup", + resource_guard_proxy_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/ResourceGuardProxyCRUD/DeleteResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/export_jobs_operation_result.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/export_jobs_operation_result.py new file mode 100644 index 000000000000..dcef523f66f2 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/export_jobs_operation_result.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python export_jobs_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.export_jobs_operation_results.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/ExportJobsOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_access_token_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_access_token_get.py new file mode 100644 index 000000000000..0933d530fd62 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_access_token_get.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_access_token_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.recovery_points.get_access_token( + vault_name="rshvault", + resource_group_name="rshhtestmdvmrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", + protected_item_name="VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", + recovery_point_id="26083826328862", + parameters={ + "properties": { + "audience": "https://RecoveryServices/IaasCoord/aadmgmt/ase", + "servicePrincipalObjectId": "5ecd8123-cf74-4037-83e9-9246b227b351", + "tenantId": "33e01921-4d64-4f8c-a055-5bdaffd5e33d", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/GetAccessToken_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_backup_status.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_backup_status.py new file mode 100644 index 000000000000..c6a4a044f61a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_backup_status.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_backup_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_status.get( + azure_region="southeastasia", + parameters={ + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Compute/VirtualMachines/testVm", + "resourceType": "VM", + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/GetBackupStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_job_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_job_post.py new file mode 100644 index 000000000000..cd1e62ed8d33 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_job_post.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_crr_job_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_crr_job_details.get( + azure_region="southeastasia", + parameters={ + "jobName": "02585cc9-d7f4-4b46-860c-14c048cce178", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Compute/VirtualMachines/testVm", + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/GetCrrJob_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_operation_results_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_operation_results_get.py new file mode 100644 index 000000000000..4a7d714cbe13 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_operation_results_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_crr_operation_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.crr_operation_results.get( + azure_region="southeastasia", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/GetCrrOperationResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_operation_status_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_operation_status_get.py new file mode 100644 index 000000000000..49f78abd7090 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_crr_operation_status_get.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_crr_operation_status_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.crr_operation_status.get( + azure_region="southeastasia", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/GetCrrOperationStatus_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_job_details.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_job_details.py new file mode 100644 index 000000000000..fd51056bca9b --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_job_details.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_job_details.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.job_details.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + job_name="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/GetJobDetails.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_private_endpoint_connection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_private_endpoint_connection.py new file mode 100644 index 000000000000..2d78531185ce --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_private_endpoint_connection.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_private_endpoint_connection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.private_endpoint_connection.get( + vault_name="gaallavaultbvtd2msi", + resource_group_name="gaallaRG", + private_endpoint_connection_name="gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/PrivateEndpointConnection/GetPrivateEndpointConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_private_endpoint_connection_operation_status.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_private_endpoint_connection_operation_status.py new file mode 100644 index 000000000000..5dd19837a1db --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_private_endpoint_connection_operation_status.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_private_endpoint_connection_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.private_endpoint.get_operation_status( + vault_name="gaallavaultbvtd2msi", + resource_group_name="gaallaRG", + private_endpoint_connection_name="gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b", + operation_id="0f48183b-0a44-4dca-aec1-bba5daab888a", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/PrivateEndpointConnection/GetPrivateEndpointConnectionOperationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_resource_guard_proxy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_resource_guard_proxy.py new file mode 100644 index 000000000000..2e44ac276567 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/get_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python get_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guard_proxy.get( + vault_name="sampleVault", + resource_group_name="SampleResourceGroup", + resource_guard_proxy_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/ResourceGuardProxyCRUD/GetResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/iaa_s_v2_daily.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/iaa_s_v2_daily.py new file mode 100644 index 000000000000..6c3d3dfffc8c --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/iaa_s_v2_daily.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python iaa_s_v2_daily.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.create_or_update( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="v2-daily-sample", + parameters={ + "properties": { + "backupManagementType": "AzureIaasVM", + "instantRpRetentionRangeInDays": 30, + "policyType": "V2", + "retentionPolicy": { + "dailySchedule": { + "retentionDuration": {"count": 180, "durationType": "Days"}, + "retentionTimes": ["2021-12-17T08:00:00+00:00"], + }, + "monthlySchedule": { + "retentionDuration": {"count": 60, "durationType": "Months"}, + "retentionScheduleDaily": None, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": {"daysOfTheWeek": ["Sunday"], "weeksOfTheMonth": ["First"]}, + "retentionTimes": ["2021-12-17T08:00:00+00:00"], + }, + "retentionPolicyType": "LongTermRetentionPolicy", + "weeklySchedule": { + "daysOfTheWeek": ["Sunday"], + "retentionDuration": {"count": 12, "durationType": "Weeks"}, + "retentionTimes": ["2021-12-17T08:00:00+00:00"], + }, + "yearlySchedule": { + "monthsOfYear": ["January"], + "retentionDuration": {"count": 10, "durationType": "Years"}, + "retentionScheduleDaily": None, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": {"daysOfTheWeek": ["Sunday"], "weeksOfTheMonth": ["First"]}, + "retentionTimes": ["2021-12-17T08:00:00+00:00"], + }, + }, + "schedulePolicy": { + "dailySchedule": {"scheduleRunTimes": ["2018-01-24T10:00:00Z"]}, + "schedulePolicyType": "SimpleSchedulePolicyV2", + "scheduleRunFrequency": "Daily", + }, + "timeZone": "India Standard Time", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/V2Policy/IaaS_v2_daily.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/iaa_s_v2_hourly.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/iaa_s_v2_hourly.py new file mode 100644 index 000000000000..79e371e31a93 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/iaa_s_v2_hourly.py @@ -0,0 +1,86 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python iaa_s_v2_hourly.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.create_or_update( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="v2-daily-sample", + parameters={ + "properties": { + "backupManagementType": "AzureIaasVM", + "instantRpRetentionRangeInDays": 30, + "policyType": "V2", + "retentionPolicy": { + "dailySchedule": { + "retentionDuration": {"count": 180, "durationType": "Days"}, + "retentionTimes": ["2021-12-17T08:00:00+00:00"], + }, + "monthlySchedule": { + "retentionDuration": {"count": 60, "durationType": "Months"}, + "retentionScheduleDaily": None, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": {"daysOfTheWeek": ["Sunday"], "weeksOfTheMonth": ["First"]}, + "retentionTimes": ["2021-12-17T08:00:00+00:00"], + }, + "retentionPolicyType": "LongTermRetentionPolicy", + "weeklySchedule": { + "daysOfTheWeek": ["Sunday"], + "retentionDuration": {"count": 12, "durationType": "Weeks"}, + "retentionTimes": ["2021-12-17T08:00:00+00:00"], + }, + "yearlySchedule": { + "monthsOfYear": ["January"], + "retentionDuration": {"count": 10, "durationType": "Years"}, + "retentionScheduleDaily": None, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": {"daysOfTheWeek": ["Sunday"], "weeksOfTheMonth": ["First"]}, + "retentionTimes": ["2021-12-17T08:00:00+00:00"], + }, + }, + "schedulePolicy": { + "hourlySchedule": { + "interval": 4, + "scheduleWindowDuration": 16, + "scheduleWindowStartTime": "2021-12-17T08:00:00Z", + }, + "schedulePolicyType": "SimpleSchedulePolicyV2", + "scheduleRunFrequency": "Hourly", + }, + "timeZone": "India Standard Time", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/V2Policy/IaaS_v2_hourly.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_crr_jobs_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_crr_jobs_post.py new file mode 100644 index 000000000000..4877bad2bc9e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_crr_jobs_post.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python list_crr_jobs_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_crr_jobs.list( + azure_region="southeastasia", + parameters={ + "jobName": "02585cc9-d7f4-4b46-860c-14c048cce178", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Compute/VirtualMachines/testVm", + }, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/ListCrrJobs_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs.py new file mode 100644 index 000000000000..56365bc88ccf --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python list_jobs.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_jobs.list( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/ListJobs.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs_with_all_supported_filters.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs_with_all_supported_filters.py new file mode 100644 index 000000000000..9f9797576b5f --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs_with_all_supported_filters.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python list_jobs_with_all_supported_filters.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_jobs.list( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/ListJobsWithAllSupportedFilters.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs_with_start_time_and_end_time_filters.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs_with_start_time_and_end_time_filters.py new file mode 100644 index 000000000000..dae5acdff47f --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_jobs_with_start_time_and_end_time_filters.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python list_jobs_with_start_time_and_end_time_filters.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_jobs.list( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/ListJobsWithStartTimeAndEndTimeFilters.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_operations.py new file mode 100644 index 000000000000..4b4e3088e161 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_operations.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python list_operations.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/ListOperations.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_resource_guard_proxy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_resource_guard_proxy.py new file mode 100644 index 000000000000..c33b5df757be --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/list_resource_guard_proxy.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python list_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guard_proxies.get( + vault_name="sampleVault", + resource_group_name="SampleResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/ResourceGuardProxyCRUD/ListResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/prepare_data_move_operation_result_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/prepare_data_move_operation_result_get.py new file mode 100644 index 000000000000..f4f4b259d05a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/prepare_data_move_operation_result_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python prepare_data_move_operation_result_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.bms_prepare_data_move_operation_result.get( + vault_name="source-rsv", + resource_group_name="sourceRG", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/BackupDataMove/PrepareDataMoveOperationResult_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/prepare_data_move_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/prepare_data_move_post.py new file mode 100644 index 000000000000..fe5d5283508d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/prepare_data_move_post.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python prepare_data_move_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.begin_bms_prepare_data_move( + vault_name="source-rsv", + resource_group_name="sourceRG", + parameters={ + "dataMoveLevel": "Vault", + "targetRegion": "USGov Virginia", + "targetResourceId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/targetRG/providers/Microsoft.RecoveryServices/vaults/target-rsv", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/BackupDataMove/PrepareDataMove_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protectable_containers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protectable_containers_list.py new file mode 100644 index 000000000000..ad43649ec51a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protectable_containers_list.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protectable_containers_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protectable_containers.list( + vault_name="testvault", + resource_group_name="testRg", + fabric_name="Azure", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureStorage/ProtectableContainers_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete.py new file mode 100644 index 000000000000..b1240c672006 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protected_item_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protected_items.delete( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + fabric_name="Azure", + container_name="iaasvmcontainer;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", + protected_item_name="vm;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/ProtectedItem_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete_operation_result.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete_operation_result.py new file mode 100644 index 000000000000..bd56ecb94a2e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete_operation_result.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protected_item_delete_operation_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_operation_results.get( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/ProtectedItem_Delete_OperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete_operation_status.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete_operation_status.py new file mode 100644 index 000000000000..9c82dd5c4906 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_delete_operation_status.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protected_item_delete_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_operation_statuses.get( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/ProtectedItem_Delete_OperationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_operation_results.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_operation_results.py new file mode 100644 index 000000000000..a293f562c9f8 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_operation_results.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protected_item_operation_results.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protected_item_operation_results.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectedItemOperationResults.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_operation_status.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_operation_status.py new file mode 100644 index 000000000000..2600a16f255b --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protected_item_operation_status.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protected_item_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protected_item_operation_statuses.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectedItemOperationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_get.py new file mode 100644 index 000000000000..efeba74d59ae --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_containers_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_containers.get( + vault_name="testVault", + resource_group_name="testRg", + fabric_name="Azure", + container_name="VMAppContainer;Compute;testRG;testSQL", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureWorkload/ProtectionContainers_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_inquire.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_inquire.py new file mode 100644 index 000000000000..895d80bffc12 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_inquire.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_containers_inquire.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_containers.inquire( + vault_name="testvault", + resource_group_name="test-rg", + fabric_name="Azure", + container_name="storagecontainer;Storage;test-rg;teststorage", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureStorage/ProtectionContainers_Inquire.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_inquire_result.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_inquire_result.py new file mode 100644 index 000000000000..d26fe54d706d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_inquire_result.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_containers_inquire_result.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_container_operation_results.get( + vault_name="testvault", + resource_group_name="test-rg", + fabric_name="Azure", + container_name="VMAppContainer;Compute;testRG;testSQL", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureStorage/ProtectionContainers_Inquire_Result.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_list.py new file mode 100644 index 000000000000..92c46ef80a66 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_containers_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_protection_containers.list( + vault_name="testVault", + resource_group_name="testRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureStorage/ProtectionContainers_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_register.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_register.py new file mode 100644 index 000000000000..b0952edea8e0 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_register.py @@ -0,0 +1,52 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_containers_register.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_containers.register( + vault_name="swaggertestvault", + resource_group_name="SwaggerTestRg", + fabric_name="Azure", + container_name="StorageContainer;Storage;SwaggerTestRg;swaggertestsa", + parameters={ + "properties": { + "acquireStorageAccountLock": "Acquire", + "backupManagementType": "AzureStorage", + "containerType": "StorageContainer", + "friendlyName": "swaggertestsa", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/SwaggerTestRg/providers/Microsoft.Storage/storageAccounts/swaggertestsa", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureStorage/ProtectionContainers_Register.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_unregister.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_unregister.py new file mode 100644 index 000000000000..0c52ae510406 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_containers_unregister.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_containers_unregister.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_containers.unregister( + vault_name="testVault", + resource_group_name="testRg", + fabric_name="Azure", + container_name="storagecontainer;Storage;test-rg;teststorage", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureWorkload/ProtectionContainers_Unregister.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_intent_create_or_update.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_intent_create_or_update.py new file mode 100644 index 000000000000..b677a4bf55e3 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_intent_create_or_update.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_intent_create_or_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_intent.create_or_update( + vault_name="myVault", + resource_group_name="myRG", + fabric_name="Azure", + intent_object_name="vm;iaasvmcontainerv2;chamsrgtest;chamscandel", + parameters={ + "properties": { + "policyId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.RecoveryServices/vaults/myVault/backupPolicies/myPolicy", + "protectionIntentItemType": "AzureResourceItem", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/chamsrgtest/providers/Microsoft.Compute/virtualMachines/chamscandel", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectionIntent_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_intent_validate.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_intent_validate.py new file mode 100644 index 000000000000..b5f9e1ad5f99 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_intent_validate.py @@ -0,0 +1,46 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_intent_validate.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_intent.validate( + azure_region="southeastasia", + parameters={ + "properties": "", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/arunaupgrade/providers/Microsoft.Compute/VirtualMachines/upgrade1", + "resourceType": "VM", + "vaultId": "/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.RecoveryServices/Vaults/myVault", + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectionIntent_Validate.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_complex.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_complex.py new file mode 100644 index 000000000000..5e65d1d56116 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_complex.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_policies_create_or_update_complex.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.create_or_update( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="testPolicy1", + parameters={ + "properties": { + "backupManagementType": "AzureIaasVM", + "retentionPolicy": { + "monthlySchedule": { + "retentionDuration": {"count": 2, "durationType": "Months"}, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": { + "daysOfTheWeek": ["Wednesday", "Thursday"], + "weeksOfTheMonth": ["First", "Third"], + }, + "retentionTimes": ["2018-01-24T10:00:00Z"], + }, + "retentionPolicyType": "LongTermRetentionPolicy", + "weeklySchedule": { + "daysOfTheWeek": ["Monday", "Wednesday", "Thursday"], + "retentionDuration": {"count": 1, "durationType": "Weeks"}, + "retentionTimes": ["2018-01-24T10:00:00Z"], + }, + "yearlySchedule": { + "monthsOfYear": ["February", "November"], + "retentionDuration": {"count": 4, "durationType": "Years"}, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": { + "daysOfTheWeek": ["Monday", "Thursday"], + "weeksOfTheMonth": ["Fourth"], + }, + "retentionTimes": ["2018-01-24T10:00:00Z"], + }, + }, + "schedulePolicy": { + "schedulePolicyType": "SimpleSchedulePolicy", + "scheduleRunDays": ["Monday", "Wednesday", "Thursday"], + "scheduleRunFrequency": "Weekly", + "scheduleRunTimes": ["2018-01-24T10:00:00Z"], + }, + "timeZone": "Pacific Standard Time", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Complex.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_daily.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_daily.py new file mode 100644 index 000000000000..7b3c6b33edf2 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_daily.py @@ -0,0 +1,81 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_policies_create_or_update_daily.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.create_or_update( + vault_name="swaggertestvault", + resource_group_name="SwaggerTestRg", + policy_name="dailyPolicy2", + parameters={ + "properties": { + "backupManagementType": "AzureStorage", + "retentionPolicy": { + "dailySchedule": { + "retentionDuration": {"count": 5, "durationType": "Days"}, + "retentionTimes": ["2021-09-29T08:00:00.000Z"], + }, + "monthlySchedule": { + "retentionDuration": {"count": 60, "durationType": "Months"}, + "retentionScheduleDaily": None, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": {"daysOfTheWeek": ["Sunday"], "weeksOfTheMonth": ["First"]}, + "retentionTimes": ["2021-09-29T08:00:00.000Z"], + }, + "retentionPolicyType": "LongTermRetentionPolicy", + "weeklySchedule": { + "daysOfTheWeek": ["Sunday"], + "retentionDuration": {"count": 12, "durationType": "Weeks"}, + "retentionTimes": ["2021-09-29T08:00:00.000Z"], + }, + "yearlySchedule": { + "monthsOfYear": ["January"], + "retentionDuration": {"count": 10, "durationType": "Years"}, + "retentionScheduleDaily": None, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": {"daysOfTheWeek": ["Sunday"], "weeksOfTheMonth": ["First"]}, + "retentionTimes": ["2021-09-29T08:00:00.000Z"], + }, + }, + "schedulePolicy": { + "schedulePolicyType": "SimpleSchedulePolicy", + "scheduleRunFrequency": "Daily", + "scheduleRunTimes": ["2021-09-29T08:00:00.000Z"], + }, + "timeZone": "UTC", + "workLoadType": "AzureFileShare", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Daily.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_hourly.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_hourly.py new file mode 100644 index 000000000000..cce0135ba83a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_hourly.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_policies_create_or_update_hourly.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.create_or_update( + vault_name="swaggertestvault", + resource_group_name="SwaggerTestRg", + policy_name="newPolicy2", + parameters={ + "properties": { + "backupManagementType": "AzureStorage", + "retentionPolicy": { + "dailySchedule": { + "retentionDuration": {"count": 5, "durationType": "Days"}, + "retentionTimes": None, + }, + "monthlySchedule": { + "retentionDuration": {"count": 60, "durationType": "Months"}, + "retentionScheduleDaily": None, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": {"daysOfTheWeek": ["Sunday"], "weeksOfTheMonth": ["First"]}, + "retentionTimes": None, + }, + "retentionPolicyType": "LongTermRetentionPolicy", + "weeklySchedule": { + "daysOfTheWeek": ["Sunday"], + "retentionDuration": {"count": 12, "durationType": "Weeks"}, + "retentionTimes": None, + }, + "yearlySchedule": { + "monthsOfYear": ["January"], + "retentionDuration": {"count": 10, "durationType": "Years"}, + "retentionScheduleDaily": None, + "retentionScheduleFormatType": "Weekly", + "retentionScheduleWeekly": {"daysOfTheWeek": ["Sunday"], "weeksOfTheMonth": ["First"]}, + "retentionTimes": None, + }, + }, + "schedulePolicy": { + "hourlySchedule": { + "interval": 4, + "scheduleWindowDuration": 12, + "scheduleWindowStartTime": "2021-09-29T08:00:00.000Z", + }, + "schedulePolicyType": "SimpleSchedulePolicy", + "scheduleRunFrequency": "Hourly", + }, + "timeZone": "UTC", + "workLoadType": "AzureFileShare", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureStorage/ProtectionPolicies_CreateOrUpdate_Hourly.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_simple.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_simple.py new file mode 100644 index 000000000000..2a21fb50f30c --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_create_or_update_simple.py @@ -0,0 +1,60 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_policies_create_or_update_simple.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.create_or_update( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="testPolicy1", + parameters={ + "properties": { + "backupManagementType": "AzureIaasVM", + "retentionPolicy": { + "dailySchedule": { + "retentionDuration": {"count": 1, "durationType": "Days"}, + "retentionTimes": ["2018-01-24T02:00:00Z"], + }, + "retentionPolicyType": "LongTermRetentionPolicy", + }, + "schedulePolicy": { + "schedulePolicyType": "SimpleSchedulePolicy", + "scheduleRunFrequency": "Daily", + "scheduleRunTimes": ["2018-01-24T02:00:00Z"], + }, + "timeZone": "Pacific Standard Time", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectionPolicies_CreateOrUpdate_Simple.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_delete.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_delete.py new file mode 100644 index 000000000000..6a7026396484 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_delete.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_policies_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.begin_delete( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="testPolicy1", + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectionPolicies_Delete.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_get.py new file mode 100644 index 000000000000..f7e2b1652cdb --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policies_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_policies_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="testPolicy1", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectionPolicies_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policy_operation_results_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policy_operation_results_get.py new file mode 100644 index 000000000000..8627925e349e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policy_operation_results_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_policy_operation_results_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policy_operation_results.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="testPolicy1", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectionPolicyOperationResults_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policy_operation_statuses_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policy_operation_statuses_get.py new file mode 100644 index 000000000000..3a94e28ec614 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/protection_policy_operation_statuses_get.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python protection_policy_operation_statuses_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policy_operation_statuses.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="testPolicy1", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ProtectionPolicyOperationStatuses_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/provision_ilr.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/provision_ilr.py new file mode 100644 index 000000000000..80d9f2237ca7 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/provision_ilr.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python provision_ilr.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.item_level_recovery_connections.provision( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + fabric_name="Azure", + container_name="iaasvmcontainer;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", + protected_item_name="vm;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", + recovery_point_id="1", + parameters={ + "properties": { + "initiatorName": "Hello World", + "objectType": "IaasVMILRRegistrationRequest", + "recoveryPointId": "38823086363464", + "renewExistingRegistration": True, + "virtualMachineId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/pysdktestrg/providers/Microsoft.Compute/virtualMachines/pysdktestv2vm1", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/Provision_Ilr.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/put_private_endpoint_connection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/put_private_endpoint_connection.py new file mode 100644 index 000000000000..78d15956a26d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/put_private_endpoint_connection.py @@ -0,0 +1,54 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python put_private_endpoint_connection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.private_endpoint_connection.begin_put( + vault_name="gaallavaultbvtd2msi", + resource_group_name="gaallaRG", + private_endpoint_connection_name="gaallatestpe2.5704c932-249a-490b-a142-1396838cd3b", + parameters={ + "properties": { + "privateEndpoint": { + "id": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/gaallaRG/providers/Microsoft.Network/privateEndpoints/gaallatestpe3" + }, + "privateLinkServiceConnectionState": { + "description": "Approved by johndoe@company.com", + "status": "Approved", + }, + "provisioningState": "Succeeded", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/PrivateEndpointConnection/PutPrivateEndpointConnection.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/put_resource_guard_proxy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/put_resource_guard_proxy.py new file mode 100644 index 000000000000..cc94d90a1194 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/put_resource_guard_proxy.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python put_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guard_proxy.put( + vault_name="sampleVault", + resource_group_name="SampleResourceGroup", + resource_guard_proxy_name="swaggerExample", + parameters={ + "properties": { + "resourceGuardResourceId": "/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew" + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/ResourceGuardProxyCRUD/PutResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_get.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_get.py new file mode 100644 index 000000000000..ffb573cb9307 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_get.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python recovery_points_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.recovery_points.get( + vault_name="rshvault", + resource_group_name="rshhtestmdvmrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", + protected_item_name="VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", + recovery_point_id="26083826328862", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/RecoveryPoints_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_list.py new file mode 100644 index 000000000000..6e43f303931b --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_list.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python recovery_points_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.recovery_points.list( + vault_name="rshvault", + resource_group_name="rshhtestmdvmrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", + protected_item_name="VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/RecoveryPoints_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_recommended_for_move_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_recommended_for_move_list.py new file mode 100644 index 000000000000..de82485611ce --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/recovery_points_recommended_for_move_list.py @@ -0,0 +1,49 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python recovery_points_recommended_for_move_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.recovery_points_recommended_for_move.list( + vault_name="rshvault", + resource_group_name="rshhtestmdvmrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", + protected_item_name="VM;iaasvmcontainerv2;rshhtestmdvmrg;rshmdvmsmall", + parameters={ + "excludedRPList": ["348916168024334", "348916168024335"], + "objectType": "ListRecoveryPointsRecommendedForMoveRequest", + }, + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/RecoveryPointsRecommendedForMove_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/refresh_containers.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/refresh_containers.py new file mode 100644 index 000000000000..0b39136b516d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/refresh_containers.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python refresh_containers.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_containers.refresh( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + fabric_name="Azure", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/RefreshContainers.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/refresh_containers_operation_results.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/refresh_containers_operation_results.py new file mode 100644 index 000000000000..0b6ee1df0c4d --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/refresh_containers_operation_results.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python refresh_containers_operation_results.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_container_refresh_operation_results.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + fabric_name="Azure", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/RefreshContainers_OperationResults.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/revoke_ilr.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/revoke_ilr.py new file mode 100644 index 000000000000..9e56f48f83a1 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/revoke_ilr.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python revoke_ilr.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.item_level_recovery_connections.revoke( + vault_name="PySDKBackupTestRsVault", + resource_group_name="PythonSDKBackupTestRg", + fabric_name="Azure", + container_name="iaasvmcontainer;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", + protected_item_name="vm;iaasvmcontainerv2;pysdktestrg;pysdktestv2vm1", + recovery_point_id="1", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/Revoke_Ilr.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/soft_deleted_containers_list.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/soft_deleted_containers_list.py new file mode 100644 index 000000000000..e2252f0fe421 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/soft_deleted_containers_list.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python soft_deleted_containers_list.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.deleted_protection_containers.list( + resource_group_name="testRg", + vault_name="testVault", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureStorage/SoftDeletedContainers_List.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/stop_protection.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/stop_protection.py new file mode 100644 index 000000000000..1c9004666130 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/stop_protection.py @@ -0,0 +1,51 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python stop_protection.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protected_items.create_or_update( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + parameters={ + "properties": { + "protectedItemType": "Microsoft.Compute/virtualMachines", + "protectionState": "ProtectionStopped", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + } + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/StopProtection.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_backup_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_backup_post.py new file mode 100644 index 000000000000..82e2a2272317 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_backup_post.py @@ -0,0 +1,45 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_backup_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backups.trigger( + vault_name="linuxRsVault", + resource_group_name="linuxRsVaultRG", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;testrg;v1win2012r", + protected_item_name="VM;iaasvmcontainerv2;testrg;v1win2012r", + parameters={"properties": {"objectType": "IaasVMBackupRequest"}}, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/TriggerBackup_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cancel_job.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cancel_job.py new file mode 100644 index 000000000000..d4447261c305 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cancel_job.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_cancel_job.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.job_cancellations.trigger( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + job_name="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/TriggerCancelJob.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cross_region_restore_identity_based_restore_details_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cross_region_restore_identity_based_restore_details_post.py new file mode 100644 index 000000000000..0aff56792c71 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cross_region_restore_identity_based_restore_details_post.py @@ -0,0 +1,87 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_cross_region_restore_identity_based_restore_details_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cross_region_restore.begin_trigger( + azure_region="southeastasia", + parameters={ + "crossRegionRestoreAccessDetails": { + "accessTokenString": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkhqaUJHdVExa2lWV2hyc2lzLUhEckhyWVZNbyJ9.eyJVc2VySWRlbnRpdHlUeXBlIjoiQUFEIiwiQWFkVGVuYW50SWQiOiIzM2UwMTkyMS00ZDY0LTRmOGMtYTA1NS01YmRhZmZkNWUzM2QiLCJBYWRTUE9iamVjdElkIjoiOTMzMjc2ZmMtMWJiNy00ZWNiLTk0ZTYtYWY3ODMyNWY3MjZhIiwiUmVzdG9yZVBvaW50UGVybWlzc2lvbnMiOiJSZWFkIiwiUmVzdG9yZVBvaW50SUQiOiJyZXNvdXJjZXMvMTMzMDgzNzkwNjQxODEzODE2MC9wcm90ZWN0aW9uQ29udGFpbmVycy8xMTE0Ni9wcm90ZWN0ZWRJdGVtcy8xMTQyOTM3MDMxL3JlY292ZXJ5UG9pbnRzLzg3MTc4MzU1MzkyNzE2IiwiaXNzIjoiaHR0cHM6Ly9SZWNvdmVyeVNlcnZpY2UiLCJhdWQiOiJodHRwczovL1JlY292ZXJ5U2VydmljZXMvUHJvdGVjdGlvblNlcnZpY2UiLCJleHAiOjE1NzExMjE5ODYsIm5iZiI6MTU3MTAzNTI4Nn0.oNbeX8ueE6JRGU0IagFjkOlU-o48ez9gCeCrn1-8XEsaVtYJIFKq9FeHfPAoCMxiLQvwL7S0JTjDTjiEsZEvr_VM7tDVwW3sESo2oW-SZlxT_1dJiUBn0jVlQyfDcHEMzbkaTuZswgNWfowgOrnJ67y-ztSUcegf3eVKPEhN1enBBS7pIuL9bZ3SVwMuqznUen6dH54y9lN2w6H14X0UK2CwSN94Uh-spB27j9SbksxLY_tyZm6xsamZFTHpwbgZwR24-GDtElPSxpFL6n_tWLSCHQtN9s84o0X7PfFaMkVmGWbOf4AZmP9M6agagG0JLnlOwObr07YrzZRkg3s2eQ", + "backupManagementType": "AzureIaasVM", + "containerName": "iaasvmcontainerv2;srinivasccyrg;sriniccylinux", + "containerType": "IaasVMContainer", + "coordinatorServiceStampUri": "https://pod01-coord1.ccy.backup.windowsazure.com", + "datasourceContainerName": "iaasvmcontainerv2;srinivasccyrg;sriniccylinux", + "datasourceId": "1142937031", + "datasourceName": "sriniccylinux", + "datasourceType": "VM", + "objectType": "WorkloadCrrAccessToken", + "protectionServiceStampId": "90d98224-2ac6-4bda-9f35-33fb22841f2a", + "protectionServiceStampUri": "https://pod01-prot1-int.ccy.backup.windowsazure.com", + "recoveryPointId": "87178355392716", + "recoveryPointTime": "10/9/2019 6:05:54 PM", + "resourceGroupName": "srinivasccyrg", + "resourceId": "1330837906418138160", + "resourceName": "sriniccyvault", + "subscriptionId": "f2edfd5d-5496-4683-b94f-b3588c579009", + "tokenExtendedInformation": 'V2015_09f2edfd5d-5496-4683-b94f-b3588c579009;AzureBackup_sriniccylinux_1142937031;AzureBackup_20191009_060554;AzureBackupRG_centraluseuap_1truetruefalseLinuxFileSystemConsistentPremiumVMOnPremiumStorageStandard_D2s_v3', + }, + "restoreRequest": { + "affinityGroup": "", + "createNewCloudService": False, + "encryptionDetails": {"encryptionEnabled": False}, + "identityBasedRestoreDetails": { + "targetStorageAccountId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00prjaiTestRg1/providers/Microsoft.Storage/storageAccounts/00prjaitestrg1disks993" + }, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "87178355392716", + "recoveryType": "AlternateLocation", + "region": "eastus2euap", + "sourceResourceId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/srinivasccyrg/providers/Microsoft.Compute/virtualMachines/sriniccylinux", + "subnetId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAcklVaultCCY/providers/Microsoft.Network/virtualNetworks/00networkAcklVaultCCY-vnet/subnets/default", + "targetDomainNameId": None, + "targetResourceGroupId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAckl", + "targetVirtualMachineId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAckl/providers/Microsoft.Compute/virtualMachines/gaallaVM", + "virtualNetworkId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAcklVaultCCY/providers/Microsoft.Network/virtualNetworks/00networkAcklVaultCCY-vnet", + "zones": ["2"], + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/TriggerCrossRegionRestore_IdentityBasedRestoreDetails_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cross_region_restore_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cross_region_restore_post.py new file mode 100644 index 000000000000..62cce58ef7ab --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_cross_region_restore_post.py @@ -0,0 +1,85 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupPassiveClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_cross_region_restore_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupPassiveClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.cross_region_restore.begin_trigger( + azure_region="southeastasia", + parameters={ + "crossRegionRestoreAccessDetails": { + "accessTokenString": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6IkhqaUJHdVExa2lWV2hyc2lzLUhEckhyWVZNbyJ9.eyJVc2VySWRlbnRpdHlUeXBlIjoiQUFEIiwiQWFkVGVuYW50SWQiOiIzM2UwMTkyMS00ZDY0LTRmOGMtYTA1NS01YmRhZmZkNWUzM2QiLCJBYWRTUE9iamVjdElkIjoiOTMzMjc2ZmMtMWJiNy00ZWNiLTk0ZTYtYWY3ODMyNWY3MjZhIiwiUmVzdG9yZVBvaW50UGVybWlzc2lvbnMiOiJSZWFkIiwiUmVzdG9yZVBvaW50SUQiOiJyZXNvdXJjZXMvMTMzMDgzNzkwNjQxODEzODE2MC9wcm90ZWN0aW9uQ29udGFpbmVycy8xMTE0Ni9wcm90ZWN0ZWRJdGVtcy8xMTQyOTM3MDMxL3JlY292ZXJ5UG9pbnRzLzg3MTc4MzU1MzkyNzE2IiwiaXNzIjoiaHR0cHM6Ly9SZWNvdmVyeVNlcnZpY2UiLCJhdWQiOiJodHRwczovL1JlY292ZXJ5U2VydmljZXMvUHJvdGVjdGlvblNlcnZpY2UiLCJleHAiOjE1NzExMjE5ODYsIm5iZiI6MTU3MTAzNTI4Nn0.oNbeX8ueE6JRGU0IagFjkOlU-o48ez9gCeCrn1-8XEsaVtYJIFKq9FeHfPAoCMxiLQvwL7S0JTjDTjiEsZEvr_VM7tDVwW3sESo2oW-SZlxT_1dJiUBn0jVlQyfDcHEMzbkaTuZswgNWfowgOrnJ67y-ztSUcegf3eVKPEhN1enBBS7pIuL9bZ3SVwMuqznUen6dH54y9lN2w6H14X0UK2CwSN94Uh-spB27j9SbksxLY_tyZm6xsamZFTHpwbgZwR24-GDtElPSxpFL6n_tWLSCHQtN9s84o0X7PfFaMkVmGWbOf4AZmP9M6agagG0JLnlOwObr07YrzZRkg3s2eQ", + "backupManagementType": "AzureIaasVM", + "containerName": "iaasvmcontainerv2;srinivasccyrg;sriniccylinux", + "containerType": "IaasVMContainer", + "coordinatorServiceStampUri": "https://pod01-coord1.ccy.backup.windowsazure.com", + "datasourceContainerName": "iaasvmcontainerv2;srinivasccyrg;sriniccylinux", + "datasourceId": "1142937031", + "datasourceName": "sriniccylinux", + "datasourceType": "VM", + "objectType": "WorkloadCrrAccessToken", + "protectionServiceStampId": "90d98224-2ac6-4bda-9f35-33fb22841f2a", + "protectionServiceStampUri": "https://pod01-prot1-int.ccy.backup.windowsazure.com", + "recoveryPointId": "87178355392716", + "recoveryPointTime": "10/9/2019 6:05:54 PM", + "resourceGroupName": "srinivasccyrg", + "resourceId": "1330837906418138160", + "resourceName": "sriniccyvault", + "subscriptionId": "f2edfd5d-5496-4683-b94f-b3588c579009", + "tokenExtendedInformation": 'V2015_09f2edfd5d-5496-4683-b94f-b3588c579009;AzureBackup_sriniccylinux_1142937031;AzureBackup_20191009_060554;AzureBackupRG_centraluseuap_1truetruefalseLinuxFileSystemConsistentPremiumVMOnPremiumStorageStandard_D2s_v3', + }, + "restoreRequest": { + "affinityGroup": "", + "createNewCloudService": False, + "encryptionDetails": {"encryptionEnabled": False}, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "87178355392716", + "recoveryType": "AlternateLocation", + "region": "eastus2euap", + "sourceResourceId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/srinivasccyrg/providers/Microsoft.Compute/virtualMachines/sriniccylinux", + "storageAccountId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00prjaiTestRg1/providers/Microsoft.Storage/storageAccounts/00prjaitestrg1disks993", + "subnetId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAcklVaultCCY/providers/Microsoft.Network/virtualNetworks/00networkAcklVaultCCY-vnet/subnets/default", + "targetDomainNameId": None, + "targetResourceGroupId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAckl", + "targetVirtualMachineId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAckl/providers/Microsoft.Compute/virtualMachines/gaallaVM", + "virtualNetworkId": "/subscriptions/f2edfd5d-5496-4683-b94f-b3588c579009/resourceGroups/00networkAcklVaultCCY/providers/Microsoft.Network/virtualNetworks/00networkAcklVaultCCY-vnet", + "zones": ["2"], + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/stable/2021-11-15/examples/AzureIaasVm/TriggerCrossRegionRestore_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_data_move_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_data_move_post.py new file mode 100644 index 000000000000..e6ce32509838 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_data_move_post.py @@ -0,0 +1,47 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_data_move_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.begin_bms_trigger_data_move( + vault_name="target-rsv", + resource_group_name="targetRG", + parameters={ + "correlationId": "MTg2OTcyMzM4NzYyMjc1NDY3Nzs1YmUzYmVmNi04YjJiLTRhOTItOTllYi01NTM0MDllYjk2NjE=", + "dataMoveLevel": "Vault", + "sourceRegion": "USGov Iowa", + "sourceResourceId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/sourceRG/providers/Microsoft.RecoveryServices/vaults/source-rsv", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/BackupDataMove/TriggerDataMove_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_export_jobs.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_export_jobs.py new file mode 100644 index 000000000000..ffb8751eb17a --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_export_jobs.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_export_jobs.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.jobs.export( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/Common/TriggerExportJobs.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_recovery_point_move_post.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_recovery_point_move_post.py new file mode 100644 index 000000000000..7a804b3c2897 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_recovery_point_move_post.py @@ -0,0 +1,50 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_recovery_point_move_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.begin_move_recovery_point( + vault_name="testVault", + resource_group_name="netsdktestrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + recovery_point_id="348916168024334", + parameters={ + "objectType": "MoveRPAcrossTiersRequest", + "sourceTierType": "HardenedRP", + "targetTierType": "ArchivedRP", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/TriggerRecoveryPointMove_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_request.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_request.py new file mode 100644 index 000000000000..7184b80cb01e --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_request.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_restore_alr_iaas_vm_restore_request.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.restores.begin_trigger( + vault_name="testVault", + resource_group_name="netsdktestrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + recovery_point_id="348916168024334", + parameters={ + "properties": { + "createNewCloudService": False, + "encryptionDetails": {"encryptionEnabled": False}, + "identityInfo": {"isSystemAssignedIdentity": True}, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryType": "AlternateLocation", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + "storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Storage/storageAccounts/testingAccount", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet/subnets/default", + "targetResourceGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2", + "targetVirtualMachineId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2/providers/Microsoft.Compute/virtualmachines/RSMDALRVM981435", + "virtualNetworkId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_request_identity_based_restore_details.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_request_identity_based_restore_details.py new file mode 100644 index 000000000000..1002c5091a88 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_request_identity_based_restore_details.py @@ -0,0 +1,65 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_restore_alr_iaas_vm_restore_request_identity_based_restore_details.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.restores.begin_trigger( + vault_name="testVault", + resource_group_name="netsdktestrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + recovery_point_id="348916168024334", + parameters={ + "properties": { + "createNewCloudService": False, + "encryptionDetails": {"encryptionEnabled": False}, + "identityBasedRestoreDetails": { + "targetStorageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Storage/storageAccounts/testingAccount" + }, + "identityInfo": {"isSystemAssignedIdentity": True}, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryType": "AlternateLocation", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet/subnets/default", + "targetResourceGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2", + "targetVirtualMachineId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2/providers/Microsoft.Compute/virtualmachines/RSMDALRVM981435", + "virtualNetworkId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_with_rehydration_request.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_with_rehydration_request.py new file mode 100644 index 000000000000..1235ef5fb50f --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_alr_iaas_vm_restore_with_rehydration_request.py @@ -0,0 +1,63 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_restore_alr_iaas_vm_restore_with_rehydration_request.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.restores.begin_trigger( + vault_name="testVault", + resource_group_name="netsdktestrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + recovery_point_id="348916168024334", + parameters={ + "properties": { + "createNewCloudService": False, + "encryptionDetails": {"encryptionEnabled": False}, + "objectType": "IaasVMRestoreWithRehydrationRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryPointRehydrationInfo": {"rehydrationPriority": "High", "rehydrationRetentionDuration": "P7D"}, + "recoveryType": "AlternateLocation", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + "storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Storage/storageAccounts/testingAccount", + "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet/subnets/default", + "targetResourceGroupId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2", + "targetVirtualMachineId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg2/providers/Microsoft.Compute/virtualmachines/RSMDALRVM981435", + "virtualNetworkId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testRg/providers/Microsoft.Network/virtualNetworks/testNet", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/TriggerRestore_ALR_IaasVMRestoreWithRehydrationRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_request.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_request.py new file mode 100644 index 000000000000..b40014ecef04 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_request.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_restore_restore_disks_iaas_vm_restore_request.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.restores.begin_trigger( + vault_name="testVault", + resource_group_name="netsdktestrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + recovery_point_id="348916168024334", + parameters={ + "properties": { + "createNewCloudService": True, + "encryptionDetails": {"encryptionEnabled": False}, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryType": "RestoreDisks", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + "storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_request_identity_based_restore_details.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_request_identity_based_restore_details.py new file mode 100644 index 000000000000..ee18db129d25 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_request_identity_based_restore_details.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_restore_restore_disks_iaas_vm_restore_request_identity_based_restore_details.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.restores.begin_trigger( + vault_name="testVault", + resource_group_name="netsdktestrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + recovery_point_id="348916168024334", + parameters={ + "properties": { + "createNewCloudService": True, + "encryptionDetails": {"encryptionEnabled": False}, + "identityBasedRestoreDetails": { + "targetStorageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount" + }, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryType": "RestoreDisks", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreRequest_IdentityBasedRestoreDetails.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_with_rehydration_request.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_with_rehydration_request.py new file mode 100644 index 000000000000..382338092178 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_restore_restore_disks_iaas_vm_restore_with_rehydration_request.py @@ -0,0 +1,62 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_restore_restore_disks_iaas_vm_restore_with_rehydration_request.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.restores.begin_trigger( + vault_name="testVault", + resource_group_name="netsdktestrg", + fabric_name="Azure", + container_name="IaasVMContainer;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + protected_item_name="VM;iaasvmcontainerv2;netsdktestrg;netvmtestv2vm1", + recovery_point_id="348916168024334", + parameters={ + "properties": { + "createNewCloudService": True, + "encryptionDetails": {"encryptionEnabled": False}, + "objectType": "IaasVMRestoreWithRehydrationRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryPointRehydrationInfo": { + "rehydrationPriority": "Standard", + "rehydrationRetentionDuration": "P7D", + }, + "recoveryType": "RestoreDisks", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + "storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/TriggerRestore_RestoreDisks_IaasVMRestoreWithRehydrationRequest.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_validate_operation_restore_disk.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_validate_operation_restore_disk.py new file mode 100644 index 000000000000..10db2bd98af0 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/trigger_validate_operation_restore_disk.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python trigger_validate_operation_restore_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.validate_operation.begin_trigger( + vault_name="testVault", + resource_group_name="testRG", + parameters={ + "objectType": "ValidateIaasVMRestoreOperationRequest", + "restoreRequest": { + "createNewCloudService": True, + "encryptionDetails": {"encryptionEnabled": False}, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryType": "RestoreDisks", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + "storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount", + }, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/TriggerValidateOperation_RestoreDisk.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/unlock_delete_resource_guard_proxy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/unlock_delete_resource_guard_proxy.py new file mode 100644 index 000000000000..487be15b1cb9 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/unlock_delete_resource_guard_proxy.py @@ -0,0 +1,48 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python unlock_delete_resource_guard_proxy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guard_proxy.unlock_delete( + vault_name="sampleVault", + resource_group_name="SampleResourceGroup", + resource_guard_proxy_name="swaggerExample", + parameters={ + "resourceGuardOperationRequests": [ + "/subscriptions/c999d45b-944f-418c-a0d8-c3fcfd1802c8/resourceGroups/vaultguardRGNew/providers/Microsoft.DataProtection/resourceGuards/VaultGuardTestNew/deleteProtectedItemRequests/default" + ], + "resourceToBeDeleted": "/subscriptions/62b829ee-7936-40c9-a1c9-47a93f9f3965/resourceGroups/gaallarg/providers/Microsoft.RecoveryServices/vaults/MercuryCrrVault/backupFabrics/Azure/protectionContainers/VMAppContainer;compute;crrtestrg;crrtestvm/protectedItems/SQLDataBase;mssqlserver;testdb", + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/ResourceGuardProxyCRUD/UnlockDeleteResourceGuardProxy.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/v2_get_policy.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/v2_get_policy.py new file mode 100644 index 000000000000..20a3ab713ec4 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/v2_get_policy.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python v2_get_policy.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.protection_policies.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + policy_name="v2-daily-sample", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/V2Policy/v2-Get-Policy.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/v2_list_policies.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/v2_list_policies.py new file mode 100644 index 000000000000..4442bbe2c6ed --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/v2_list_policies.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python v2_list_policies.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.backup_policies.list( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/V2Policy/v2-List-Policies.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_restore_disk.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_restore_disk.py new file mode 100644 index 000000000000..544ff41d1c84 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_restore_disk.py @@ -0,0 +1,59 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python validate_operation_restore_disk.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.operation.validate( + vault_name="testVault", + resource_group_name="testRG", + parameters={ + "objectType": "ValidateIaasVMRestoreOperationRequest", + "restoreRequest": { + "createNewCloudService": True, + "encryptionDetails": {"encryptionEnabled": False}, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryType": "RestoreDisks", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + "storageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ValidateOperation_RestoreDisk.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_restore_disk_identity_based_restore_details.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_restore_disk_identity_based_restore_details.py new file mode 100644 index 000000000000..9c996c56e707 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_restore_disk_identity_based_restore_details.py @@ -0,0 +1,61 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python validate_operation_restore_disk_identity_based_restore_details.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.operation.validate( + vault_name="testVault", + resource_group_name="testRG", + parameters={ + "objectType": "ValidateIaasVMRestoreOperationRequest", + "restoreRequest": { + "createNewCloudService": True, + "encryptionDetails": {"encryptionEnabled": False}, + "identityBasedRestoreDetails": { + "targetStorageAccountId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testingRg/providers/Microsoft.Storage/storageAccounts/testAccount" + }, + "identityInfo": { + "isSystemAssignedIdentity": False, + "managedIdentityResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/asmaskarRG1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/asmaskartestmsi", + }, + "objectType": "IaasVMRestoreRequest", + "originalStorageAccountOption": False, + "recoveryPointId": "348916168024334", + "recoveryType": "RestoreDisks", + "region": "southeastasia", + "sourceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/netsdktestrg/providers/Microsoft.Compute/virtualMachines/netvmtestv2vm1", + }, + }, + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ValidateOperation_RestoreDisk_IdentityBasedRestoreDetails.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_results.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_results.py new file mode 100644 index 000000000000..524d5592cedf --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_results.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python validate_operation_results.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.validate_operation_results.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ValidateOperationResults.json +if __name__ == "__main__": + main() diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_status.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_status.py new file mode 100644 index 000000000000..d853ba3598c7 --- /dev/null +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/generated_samples/validate_operation_status.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential +from azure.mgmt.recoveryservicesbackup import RecoveryServicesBackupClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-recoveryservicesbackup +# USAGE + python validate_operation_status.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = RecoveryServicesBackupClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.validate_operation_statuses.get( + vault_name="NetSDKTestRsVault", + resource_group_name="SwaggerTestRg", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/recoveryservicesbackup/resource-manager/Microsoft.RecoveryServices/preview/2022-09-01-preview/examples/AzureIaasVm/ValidateOperationStatus.json +if __name__ == "__main__": + main()