diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json index b8a794575580..29aa171541cc 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json +++ b/sdk/dataprotection/azure-mgmt-dataprotection/_meta.json @@ -1,11 +1,11 @@ { + "commit": "692ab385680a72a987ad0aa4e98e64779185d1ce", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.1.9", + "@autorest/python@6.2.7", "@autorest/modelerfour@4.24.3" ], - "commit": "33d5054122e52490eef9925d6cbe801f28b88e18", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/dataprotection/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.1.9 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/dataprotection/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/dataprotection/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py index 9ffe357babbb..19879ce094f6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/__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__ = ["DataProtectionClient"] +__all__ = [ + "DataProtectionClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py index aab2a807afea..8d178c0347a6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_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 @@ -27,16 +33,16 @@ class DataProtectionClientConfiguration(Configuration): # pylint: disable=too-m :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataProtectionClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", "2022-12-01") 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-dataprotection/{}".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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py index 396ee5728644..9bb2b9c5464f 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_data_protection_client.py @@ -12,11 +12,10 @@ from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from . import models +from . import models as _models from ._configuration import DataProtectionClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( - BackupInstancesExtensionRoutingOperations, BackupInstancesOperations, BackupPoliciesOperations, BackupVaultOperationResultsOperations, @@ -24,7 +23,6 @@ DataProtectionOperations, DataProtectionOperationsOperations, DeletedBackupInstancesOperations, - DppResourceGuardProxyOperations, ExportJobsOperationResultOperations, ExportJobsOperations, JobsOperations, @@ -71,9 +69,6 @@ class DataProtectionClient: # pylint: disable=client-accepts-api-version-keywor :vartype backup_policies: azure.mgmt.dataprotection.operations.BackupPoliciesOperations :ivar backup_instances: BackupInstancesOperations operations :vartype backup_instances: azure.mgmt.dataprotection.operations.BackupInstancesOperations - :ivar backup_instances_extension_routing: BackupInstancesExtensionRoutingOperations operations - :vartype backup_instances_extension_routing: - azure.mgmt.dataprotection.operations.BackupInstancesExtensionRoutingOperations :ivar recovery_points: RecoveryPointsOperations operations :vartype recovery_points: azure.mgmt.dataprotection.operations.RecoveryPointsOperations :ivar jobs: JobsOperations operations @@ -91,17 +86,14 @@ class DataProtectionClient: # pylint: disable=client-accepts-api-version-keywor azure.mgmt.dataprotection.operations.DeletedBackupInstancesOperations :ivar resource_guards: ResourceGuardsOperations operations :vartype resource_guards: azure.mgmt.dataprotection.operations.ResourceGuardsOperations - :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations - :vartype dpp_resource_guard_proxy: - azure.mgmt.dataprotection.operations.DppResourceGuardProxyOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -119,7 +111,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 @@ -147,9 +139,6 @@ def __init__( self.backup_instances = BackupInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.backup_instances_extension_routing = BackupInstancesExtensionRoutingOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) self.restorable_time_ranges = RestorableTimeRangesOperations( @@ -163,9 +152,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -189,15 +175,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: () -> DataProtectionClient + def __enter__(self) -> "DataProtectionClient": 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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py index 7c1dedb5133d..2c170e28dbca 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_serialization.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_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/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py index dfa6ee022f15..e5754a47ce68 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b1" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py index 169eab7dbe21..6be723aa6805 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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__ = ["DataProtectionClient"] +__all__ = [ + "DataProtectionClient", +] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py index d04a341320d8..b08fc5350b85 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_configuration.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/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 @@ -27,16 +33,16 @@ class DataProtectionClientConfiguration(Configuration): # pylint: disable=too-m :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(DataProtectionClientConfiguration, self).__init__(**kwargs) - api_version = kwargs.pop("api_version", "2022-09-01-preview") # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", "2022-12-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py index 4ea500245666..da20f09bea8c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/_data_protection_client.py @@ -12,11 +12,10 @@ 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 DataProtectionClientConfiguration from .operations import ( - BackupInstancesExtensionRoutingOperations, BackupInstancesOperations, BackupPoliciesOperations, BackupVaultOperationResultsOperations, @@ -24,7 +23,6 @@ DataProtectionOperations, DataProtectionOperationsOperations, DeletedBackupInstancesOperations, - DppResourceGuardProxyOperations, ExportJobsOperationResultOperations, ExportJobsOperations, JobsOperations, @@ -71,9 +69,6 @@ class DataProtectionClient: # pylint: disable=client-accepts-api-version-keywor :vartype backup_policies: azure.mgmt.dataprotection.aio.operations.BackupPoliciesOperations :ivar backup_instances: BackupInstancesOperations operations :vartype backup_instances: azure.mgmt.dataprotection.aio.operations.BackupInstancesOperations - :ivar backup_instances_extension_routing: BackupInstancesExtensionRoutingOperations operations - :vartype backup_instances_extension_routing: - azure.mgmt.dataprotection.aio.operations.BackupInstancesExtensionRoutingOperations :ivar recovery_points: RecoveryPointsOperations operations :vartype recovery_points: azure.mgmt.dataprotection.aio.operations.RecoveryPointsOperations :ivar jobs: JobsOperations operations @@ -91,17 +86,14 @@ class DataProtectionClient: # pylint: disable=client-accepts-api-version-keywor azure.mgmt.dataprotection.aio.operations.DeletedBackupInstancesOperations :ivar resource_guards: ResourceGuardsOperations operations :vartype resource_guards: azure.mgmt.dataprotection.aio.operations.ResourceGuardsOperations - :ivar dpp_resource_guard_proxy: DppResourceGuardProxyOperations operations - :vartype dpp_resource_guard_proxy: - azure.mgmt.dataprotection.aio.operations.DppResourceGuardProxyOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this + default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -119,7 +111,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 @@ -147,9 +139,6 @@ def __init__( self.backup_instances = BackupInstancesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.backup_instances_extension_routing = BackupInstancesExtensionRoutingOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.recovery_points = RecoveryPointsOperations(self._client, self._config, self._serialize, self._deserialize) self.jobs = JobsOperations(self._client, self._config, self._serialize, self._deserialize) self.restorable_time_ranges = RestorableTimeRangesOperations( @@ -163,9 +152,6 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) self.resource_guards = ResourceGuardsOperations(self._client, self._config, self._serialize, self._deserialize) - self.dpp_resource_guard_proxy = DppResourceGuardProxyOperations( - self._client, self._config, self._serialize, self._deserialize - ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py index 0685deeec279..6775e75af5a7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/__init__.py @@ -16,7 +16,6 @@ from ._data_protection_operations_operations import DataProtectionOperationsOperations from ._backup_policies_operations import BackupPoliciesOperations from ._backup_instances_operations import BackupInstancesOperations -from ._backup_instances_extension_routing_operations import BackupInstancesExtensionRoutingOperations from ._recovery_points_operations import RecoveryPointsOperations from ._jobs_operations import JobsOperations from ._restorable_time_ranges_operations import RestorableTimeRangesOperations @@ -24,10 +23,9 @@ from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations from ._resource_guards_operations import ResourceGuardsOperations -from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations 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__ = [ @@ -41,7 +39,6 @@ "DataProtectionOperationsOperations", "BackupPoliciesOperations", "BackupInstancesOperations", - "BackupInstancesExtensionRoutingOperations", "RecoveryPointsOperations", "JobsOperations", "RestorableTimeRangesOperations", @@ -49,7 +46,6 @@ "ExportJobsOperationResultOperations", "DeletedBackupInstancesOperations", "ResourceGuardsOperations", - "DppResourceGuardProxyOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py deleted file mode 100644 index 55e89e6c0543..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_extension_routing_operations.py +++ /dev/null @@ -1,130 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._backup_instances_extension_routing_operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class BackupInstancesExtensionRoutingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s - :attr:`backup_instances_extension_routing` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_id: str, **kwargs: Any) -> AsyncIterable["_models.BackupInstanceResource"]: - """Gets a list backup instances associated with a tracked resource. - - :param resource_id: ARM path of the resource to be protected using Microsoft.DataProtection. - Required. - :type resource_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupInstanceResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.BackupInstanceResourceList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_id=resource_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", 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.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - 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 - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceId}/providers/Microsoft.DataProtection/backupInstances"} # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py index 17d4fb3cf7c4..62d311a29cd4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_instances_operations.py @@ -6,8 +6,9 @@ # 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, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -48,6 +49,10 @@ build_validate_for_restore_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]] @@ -77,7 +82,7 @@ def list( ) -> AsyncIterable["_models.BackupInstanceResource"]: """Gets a backup instances belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -92,8 +97,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.BackupInstanceResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -116,16 +123,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -133,13 +147,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupInstanceResourceList", 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,7 +166,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances" + } @distributed_trace_async async def get( @@ -160,7 +176,7 @@ async def get( ) -> _models.BackupInstanceResource: """Gets a backup instance with name in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -183,8 +199,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.BackupInstanceResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -197,9 +215,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 ) @@ -216,7 +234,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } async def _create_or_update_initial( self, @@ -237,9 +257,11 @@ async def _create_or_update_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[Optional[_models.BackupInstanceResource]] + api_version: Literal["2022-12-01"] = 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.BackupInstanceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -263,9 +285,9 @@ async def _create_or_update_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 ) @@ -294,7 +316,9 @@ async def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } @overload async def begin_create_or_update( @@ -309,7 +333,7 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.BackupInstanceResource]: """Create or update a backup instance in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -349,7 +373,7 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.BackupInstanceResource]: """Create or update a backup instance in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -387,7 +411,7 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.BackupInstanceResource]: """Create or update a backup instance in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -416,14 +440,16 @@ async def begin_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.BackupInstanceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-12-01"] = 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.BackupInstanceResource] = 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._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -444,7 +470,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: @@ -456,9 +482,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_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -474,8 +502,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -488,9 +518,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 ) @@ -511,7 +541,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } @distributed_trace_async async def begin_delete( @@ -519,7 +551,7 @@ async def begin_delete( ) -> AsyncLROPoller[None]: """Delete a backup instance in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -541,11 +573,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-12-01"] = 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 resource_group_name=resource_group_name, @@ -564,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(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: @@ -576,9 +610,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_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } async def _adhoc_backup_initial( self, @@ -599,9 +635,11 @@ async def _adhoc_backup_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -625,9 +663,9 @@ async def _adhoc_backup_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 ) @@ -654,7 +692,9 @@ async def _adhoc_backup_initial( return deserialized - _adhoc_backup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup"} # type: ignore + _adhoc_backup_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup" + } @overload async def begin_adhoc_backup( @@ -669,7 +709,7 @@ async def begin_adhoc_backup( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Trigger adhoc backup. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -709,7 +749,7 @@ async def begin_adhoc_backup( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Trigger adhoc backup. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -747,7 +787,7 @@ async def begin_adhoc_backup( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Trigger adhoc backup. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -776,14 +816,16 @@ async def begin_adhoc_backup( _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.OperationJobExtendedInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo] = 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._adhoc_backup_initial( # type: ignore + raw_result = await self._adhoc_backup_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -804,7 +846,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: @@ -816,9 +858,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_adhoc_backup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup"} # type: ignore + begin_adhoc_backup.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup" + } async def _validate_for_backup_initial( self, @@ -838,9 +882,11 @@ async def _validate_for_backup_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -863,9 +909,9 @@ async def _validate_for_backup_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 ) @@ -892,7 +938,9 @@ async def _validate_for_backup_initial( return deserialized - _validate_for_backup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup"} # type: ignore + _validate_for_backup_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup" + } @overload async def begin_validate_for_backup( @@ -906,7 +954,7 @@ async def begin_validate_for_backup( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Validate whether adhoc backup will be successful or not. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -943,7 +991,7 @@ async def begin_validate_for_backup( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Validate whether adhoc backup will be successful or not. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -978,7 +1026,7 @@ async def begin_validate_for_backup( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Validate whether adhoc backup will be successful or not. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1005,14 +1053,16 @@ async def begin_validate_for_backup( _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.OperationJobExtendedInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo] = 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._validate_for_backup_initial( # type: ignore + raw_result = await self._validate_for_backup_initial( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, @@ -1032,7 +1082,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: @@ -1044,9 +1094,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_validate_for_backup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup"} # type: ignore + begin_validate_for_backup.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup" + } @distributed_trace_async async def get_backup_instance_operation_result( @@ -1054,12 +1106,12 @@ async def get_backup_instance_operation_result( ) -> Optional[_models.BackupInstanceResource]: """Get result of backup instance creation operation. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param operation_id: Required. :type operation_id: str @@ -1079,8 +1131,10 @@ async def get_backup_instance_operation_result( _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.BackupInstanceResource]] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) request = build_get_backup_instance_operation_result_request( resource_group_name=resource_group_name, @@ -1094,9 +1148,9 @@ async def get_backup_instance_operation_result( 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 ) @@ -1115,7 +1169,9 @@ async def get_backup_instance_operation_result( return deserialized - get_backup_instance_operation_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}"} # type: ignore + get_backup_instance_operation_result.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}" + } async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements self, @@ -1136,9 +1192,11 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta _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-12-01"] = 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 @@ -1162,9 +1220,9 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta 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 ) @@ -1185,7 +1243,9 @@ async def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, response_headers) - _trigger_rehydrate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate"} # type: ignore + _trigger_rehydrate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate" + } @overload async def begin_trigger_rehydrate( @@ -1200,12 +1260,12 @@ async def begin_trigger_rehydrate( ) -> AsyncLROPoller[None]: """rehydrate recovery point for restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Required. :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest @@ -1238,12 +1298,12 @@ async def begin_trigger_rehydrate( ) -> AsyncLROPoller[None]: """rehydrate recovery point for restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Required. :type parameters: IO @@ -1274,12 +1334,12 @@ async def begin_trigger_rehydrate( ) -> AsyncLROPoller[None]: """rehydrate recovery point for restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest or IO @@ -1301,12 +1361,14 @@ async def begin_trigger_rehydrate( _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-12-01"] = 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_rehydrate_initial( # type: ignore resource_group_name=resource_group_name, @@ -1327,7 +1389,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: @@ -1339,9 +1401,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_trigger_rehydrate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate"} # type: ignore + begin_trigger_rehydrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate" + } async def _trigger_restore_initial( self, @@ -1362,9 +1426,11 @@ async def _trigger_restore_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1388,9 +1454,9 @@ async def _trigger_restore_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 ) @@ -1417,7 +1483,9 @@ async def _trigger_restore_initial( return deserialized - _trigger_restore_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore"} # type: ignore + _trigger_restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore" + } @overload async def begin_trigger_restore( @@ -1432,7 +1500,7 @@ async def begin_trigger_restore( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Triggers restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1472,7 +1540,7 @@ async def begin_trigger_restore( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Triggers restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1510,7 +1578,7 @@ async def begin_trigger_restore( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Triggers restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1539,14 +1607,16 @@ async def begin_trigger_restore( _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.OperationJobExtendedInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo] = 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_restore_initial( # type: ignore + raw_result = await self._trigger_restore_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -1567,7 +1637,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: @@ -1579,9 +1649,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_trigger_restore.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore"} # type: ignore + begin_trigger_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore" + } async def _resume_backups_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -1597,8 +1669,10 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem _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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_backups_request( resource_group_name=resource_group_name, @@ -1611,9 +1685,9 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem 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 ) @@ -1634,7 +1708,9 @@ async def _resume_backups_initial( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, response_headers) - _resume_backups_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups"} # type: ignore + _resume_backups_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups" + } @distributed_trace_async async def begin_resume_backups( @@ -1642,12 +1718,12 @@ async def begin_resume_backups( ) -> AsyncLROPoller[None]: """This operation will resume backups for backup instance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1664,11 +1740,13 @@ async def begin_resume_backups( _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-12-01"] = 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._resume_backups_initial( # type: ignore resource_group_name=resource_group_name, @@ -1687,7 +1765,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: @@ -1699,9 +1777,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_resume_backups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups"} # type: ignore + begin_resume_backups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups" + } async def _resume_protection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -1717,8 +1797,10 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta _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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_protection_request( resource_group_name=resource_group_name, @@ -1731,9 +1813,9 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta 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 ) @@ -1754,7 +1836,9 @@ async def _resume_protection_initial( # pylint: disable=inconsistent-return-sta if cls: return cls(pipeline_response, None, response_headers) - _resume_protection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection"} # type: ignore + _resume_protection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection" + } @distributed_trace_async async def begin_resume_protection( @@ -1762,12 +1846,12 @@ async def begin_resume_protection( ) -> AsyncLROPoller[None]: """This operation will resume protection for a stopped backup instance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1784,11 +1868,13 @@ async def begin_resume_protection( _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-12-01"] = 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._resume_protection_initial( # type: ignore resource_group_name=resource_group_name, @@ -1807,7 +1893,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: @@ -1819,9 +1905,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_resume_protection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection"} # type: ignore + begin_resume_protection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection" + } async def _stop_protection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -1837,8 +1925,10 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state _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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_protection_request( resource_group_name=resource_group_name, @@ -1851,9 +1941,9 @@ async def _stop_protection_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 = 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 ) @@ -1874,7 +1964,9 @@ async def _stop_protection_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, response_headers) - _stop_protection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection"} # type: ignore + _stop_protection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection" + } @distributed_trace_async async def begin_stop_protection( @@ -1882,12 +1974,12 @@ async def begin_stop_protection( ) -> AsyncLROPoller[None]: """This operation will stop protection of a backup instance and data will be held forever. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -1904,11 +1996,13 @@ async def begin_stop_protection( _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-12-01"] = 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._stop_protection_initial( # type: ignore resource_group_name=resource_group_name, @@ -1927,7 +2021,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: @@ -1939,9 +2033,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_stop_protection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection"} # type: ignore + begin_stop_protection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection" + } async def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -1957,8 +2053,10 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state _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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_backups_request( resource_group_name=resource_group_name, @@ -1971,9 +2069,9 @@ async def _suspend_backups_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 = 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 ) @@ -1994,7 +2092,9 @@ async def _suspend_backups_initial( # pylint: disable=inconsistent-return-state if cls: return cls(pipeline_response, None, response_headers) - _suspend_backups_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups"} # type: ignore + _suspend_backups_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups" + } @distributed_trace_async async def begin_suspend_backups( @@ -2003,12 +2103,12 @@ async def begin_suspend_backups( """This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever). - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2025,11 +2125,13 @@ async def begin_suspend_backups( _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-12-01"] = 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._suspend_backups_initial( # type: ignore resource_group_name=resource_group_name, @@ -2048,7 +2150,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: @@ -2060,9 +2162,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_suspend_backups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups"} # type: ignore + begin_suspend_backups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups" + } async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statements self, @@ -2083,9 +2187,11 @@ async def _sync_backup_instance_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-12-01"] = 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 @@ -2109,9 +2215,9 @@ async def _sync_backup_instance_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( # pylint: disable=protected-access request, stream=False, **kwargs ) @@ -2132,7 +2238,9 @@ async def _sync_backup_instance_initial( # pylint: disable=inconsistent-return- if cls: return cls(pipeline_response, None, response_headers) - _sync_backup_instance_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync"} # type: ignore + _sync_backup_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync" + } @overload async def begin_sync_backup_instance( @@ -2148,12 +2256,12 @@ async def begin_sync_backup_instance( """Sync backup instance again in case of failure This action will retry last failed operation and will bring backup instance to valid state. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Required. :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest @@ -2187,12 +2295,12 @@ async def begin_sync_backup_instance( """Sync backup instance again in case of failure This action will retry last failed operation and will bring backup instance to valid state. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Required. :type parameters: IO @@ -2224,12 +2332,12 @@ async def begin_sync_backup_instance( """Sync backup instance again in case of failure This action will retry last failed operation and will bring backup instance to valid state. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest or IO @@ -2251,12 +2359,14 @@ async def begin_sync_backup_instance( _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-12-01"] = 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._sync_backup_instance_initial( # type: ignore resource_group_name=resource_group_name, @@ -2277,7 +2387,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: @@ -2289,9 +2399,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_sync_backup_instance.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync"} # type: ignore + begin_sync_backup_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync" + } async def _validate_for_restore_initial( self, @@ -2312,9 +2424,11 @@ async def _validate_for_restore_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2338,9 +2452,9 @@ async def _validate_for_restore_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 ) @@ -2367,7 +2481,9 @@ async def _validate_for_restore_initial( return deserialized - _validate_for_restore_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore"} # type: ignore + _validate_for_restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore" + } @overload async def begin_validate_for_restore( @@ -2382,7 +2498,7 @@ async def begin_validate_for_restore( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Validates if Restore can be triggered for a DataSource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -2422,7 +2538,7 @@ async def begin_validate_for_restore( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Validates if Restore can be triggered for a DataSource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -2460,7 +2576,7 @@ async def begin_validate_for_restore( ) -> AsyncLROPoller[_models.OperationJobExtendedInfo]: """Validates if Restore can be triggered for a DataSource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -2489,14 +2605,16 @@ async def begin_validate_for_restore( _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.OperationJobExtendedInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo] = 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._validate_for_restore_initial( # type: ignore + raw_result = await self._validate_for_restore_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2517,7 +2635,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: @@ -2529,6 +2647,8 @@ 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_validate_for_restore.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore"} # type: ignore + begin_validate_for_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py index 04ce481b481a..20220d2cb5d9 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_policies_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -35,6 +36,10 @@ 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]] @@ -64,7 +69,7 @@ def list( ) -> AsyncIterable["_models.BaseBackupPolicyResource"]: """Returns list of backup policies belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -79,8 +84,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.BaseBackupPolicyResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BaseBackupPolicyResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -103,16 +110,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -120,13 +134,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BaseBackupPolicyResourceList", 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 @@ -139,7 +153,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies" + } @distributed_trace_async async def get( @@ -149,7 +165,7 @@ async def get( Gets a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -172,8 +188,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.BaseBackupPolicyResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -186,9 +204,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 ) @@ -205,7 +223,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + } @overload async def create_or_update( @@ -222,7 +242,7 @@ async def create_or_update( Creates or Updates a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -255,7 +275,7 @@ async def create_or_update( Creates or Updates a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -286,7 +306,7 @@ async def create_or_update( Creates or Updates a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -314,9 +334,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.BaseBackupPolicyResource] + api_version: Literal["2022-12-01"] = 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.BaseBackupPolicyResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -340,9 +362,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 ) @@ -359,7 +381,9 @@ async def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -369,7 +393,7 @@ async def delete( # pylint: disable=inconsistent-return-statements Deletes a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -392,8 +416,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -406,9 +432,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 ) @@ -421,4 +447,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.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py index ab042b8a4e43..83ebee0f66f3 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_operation_results_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vault_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._backup_vault_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]] @@ -56,7 +61,7 @@ async def get( ) -> Optional[_models.BackupVaultResource]: """get. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -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[Optional[_models.BackupVaultResource]] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -93,9 +100,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,4 +129,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py index 05c2c6c3b702..5f969b261783 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_backup_vaults_operations.py @@ -6,8 +6,9 @@ # 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, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -40,6 +41,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]] @@ -76,8 +81,10 @@ def get_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.BackupVau _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.BackupVaultResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,16 +105,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -115,13 +129,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupVaultResourceList", 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 @@ -134,7 +148,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults" + } @distributed_trace def get_in_resource_group( @@ -142,7 +158,7 @@ def get_in_resource_group( ) -> AsyncIterable["_models.BackupVaultResource"]: """Returns resource collection belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -154,8 +170,10 @@ def get_in_resource_group( _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.BackupVaultResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -177,16 +195,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -194,13 +219,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("BackupVaultResourceList", 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 @@ -213,13 +238,15 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_in_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults"} # type: ignore + get_in_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults" + } @distributed_trace_async async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _models.BackupVaultResource: """Returns a resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -240,8 +267,10 @@ async def get(self, resource_group_name: str, vault_name: str, **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.BackupVaultResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -253,9 +282,9 @@ async def get(self, resource_group_name: str, vault_name: str, **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 = 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 ) @@ -272,7 +301,9 @@ async def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } async def _create_or_update_initial( self, @@ -292,9 +323,11 @@ async def _create_or_update_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.BackupVaultResource] + api_version: Literal["2022-12-01"] = 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.BackupVaultResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -317,9 +350,9 @@ async def _create_or_update_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 ) @@ -336,11 +369,13 @@ async def _create_or_update_initial( deserialized = self._deserialize("BackupVaultResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } @overload async def begin_create_or_update( @@ -354,7 +389,7 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.BackupVaultResource]: """Creates or updates a BackupVault resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -391,7 +426,7 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.BackupVaultResource]: """Creates or updates a BackupVault resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -426,7 +461,7 @@ async def begin_create_or_update( ) -> AsyncLROPoller[_models.BackupVaultResource]: """Creates or updates a BackupVault resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -453,14 +488,16 @@ async def begin_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.BackupVaultResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-12-01"] = 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.BackupVaultResource] = 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._create_or_update_initial( # type: ignore + raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, @@ -480,7 +517,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: @@ -492,9 +529,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_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -502,7 +541,7 @@ async def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a BackupVault resource from the resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -523,8 +562,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -536,9 +577,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 ) @@ -551,7 +592,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.DataProtection/backupVaults/{vaultName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } async def _update_initial( self, @@ -571,9 +614,11 @@ async def _update_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[Optional[_models.BackupVaultResource]] + api_version: Literal["2022-12-01"] = 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.BackupVaultResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -596,9 +641,9 @@ async def _update_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 ) @@ -617,7 +662,9 @@ async def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } @overload async def begin_update( @@ -632,7 +679,7 @@ async def begin_update( """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -670,7 +717,7 @@ async def begin_update( """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -706,7 +753,7 @@ async def begin_update( """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -733,14 +780,16 @@ async def begin_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.BackupVaultResource] - polling = kwargs.pop("polling", True) # type: Union[bool, AsyncPollingMethod] + api_version: Literal["2022-12-01"] = 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.BackupVaultResource] = 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._update_initial( # type: ignore + raw_result = await self._update_initial( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, @@ -760,7 +809,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: @@ -772,9 +821,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_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } @overload async def check_name_availability( @@ -790,7 +841,7 @@ async def check_name_availability( API to check for resource name availability. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The location in which uniqueness will be verified. Required. @@ -820,7 +871,7 @@ async def check_name_availability( API to check for resource name availability. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The location in which uniqueness will be verified. Required. @@ -848,7 +899,7 @@ async def check_name_availability( API to check for resource name availability. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The location in which uniqueness will be verified. Required. @@ -875,9 +926,11 @@ async def check_name_availability( _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.CheckNameAvailabilityResult] + api_version: Literal["2022-12-01"] = 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.CheckNameAvailabilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -900,9 +953,9 @@ async def check_name_availability( 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 ) @@ -919,4 +972,6 @@ async def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py index 38bde5b9ee5f..0302d8431e23 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_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._data_protection_operations import build_check_feature_support_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]] @@ -129,9 +134,11 @@ async def check_feature_support( _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.FeatureValidationResponseBase] + api_version: Literal["2022-12-01"] = 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.FeatureValidationResponseBase] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -153,9 +160,9 @@ async def check_feature_support( 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 check_feature_support( return deserialized - check_feature_support.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport"} # type: ignore + check_feature_support.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py index 5588ce577985..bd2119e19658 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_data_protection_operations_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._data_protection_operations_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]] @@ -66,8 +71,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ClientDiscoveryResponse] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -87,16 +94,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -104,13 +118,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 @@ -123,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.DataProtection/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DataProtection/operations"} diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py index 8da09e291363..c5c9f65b88c6 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_deleted_backup_instances_operations.py @@ -6,8 +6,9 @@ # 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, Union, cast -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -36,6 +37,10 @@ build_undelete_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]] @@ -65,7 +70,7 @@ def list( ) -> AsyncIterable["_models.DeletedBackupInstanceResource"]: """Gets deleted backup instances belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -80,8 +85,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.DeletedBackupInstanceResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DeletedBackupInstanceResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -104,16 +111,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -121,13 +135,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DeletedBackupInstanceResourceList", 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 @@ -140,7 +154,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances" + } @distributed_trace_async async def get( @@ -148,7 +164,7 @@ async def get( ) -> _models.DeletedBackupInstanceResource: """Gets a deleted backup instance with name in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -171,8 +187,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.DeletedBackupInstanceResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -185,9 +203,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 ) @@ -204,7 +222,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}" + } async def _undelete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -220,8 +240,10 @@ async def _undelete_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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( resource_group_name=resource_group_name, @@ -234,9 +256,9 @@ async def _undelete_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 ) @@ -249,7 +271,9 @@ async def _undelete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _undelete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete"} # type: ignore + _undelete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete" + } @distributed_trace_async async def begin_undelete( @@ -257,7 +281,7 @@ async def begin_undelete( ) -> AsyncLROPoller[None]: """undelete. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -279,11 +303,13 @@ async def begin_undelete( _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-12-01"] = 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._undelete_initial( # type: ignore resource_group_name=resource_group_name, @@ -302,7 +328,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: @@ -314,6 +340,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_undelete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete"} # type: ignore + begin_undelete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py deleted file mode 100644 index b000cbbc4ca5..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_dpp_resource_guard_proxy_operations.py +++ /dev/null @@ -1,563 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._dpp_resource_guard_proxy_operations import ( - build_delete_request, - build_get_request, - build_list_request, - build_put_request, - build_unlock_delete_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class DppResourceGuardProxyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.aio.DataProtectionClient`'s - :attr:`dpp_resource_guard_proxy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ResourceGuardProxyBaseResource"]: - """list. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", 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.method = "GET" - return request - - 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) - 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 - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies"} # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """get. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore - - @overload - async def put( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: _models.ResourceGuardProxyBaseResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """put. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def put( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """put. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def put( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: Union[_models.ResourceGuardProxyBaseResource, IO], - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """put. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = 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] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") - - request = build_put_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.put.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore - - @distributed_trace_async - async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore - - @overload - async def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: _models.UnlockDeleteRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """unlock_delete. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """unlock_delete. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: Union[_models.UnlockDeleteRequest, IO], - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """unlock_delete. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = 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] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "UnlockDeleteRequest") - - request = build_unlock_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.unlock_delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - unlock_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py index f3a308739818..0ad98fc394c4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_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 ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._export_jobs_operation_result_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]] @@ -58,7 +63,7 @@ async def get( successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -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[Optional[_models.ExportJobsResult]] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_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 ) @@ -116,4 +123,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py index db6efb04f85b..11ccc96e815c 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_export_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, Union, cast from azure.core.exceptions import ( @@ -29,6 +30,10 @@ from ..._vendor import _convert_request from ...operations._export_jobs_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,8 +71,10 @@ async def _trigger_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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_trigger_request( resource_group_name=resource_group_name, @@ -79,9 +86,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 ) @@ -99,13 +106,15 @@ async def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs"} # type: ignore + _trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs" + } @distributed_trace_async async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Triggers export of jobs and returns an OperationID to track. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -125,11 +134,13 @@ async def begin_trigger(self, resource_group_name: str, vault_name: str, **kwarg _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-12-01"] = 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._trigger_initial( # type: ignore resource_group_name=resource_group_name, @@ -147,9 +158,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: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) # type: AsyncPollingMethod + ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: @@ -161,6 +172,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.DataProtection/backupVaults/{vaultName}/exportBackupJobs"} # type: ignore + begin_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py index d2e8949cd392..5444fe7e5542 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_jobs_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._jobs_operations import build_get_request, 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]] @@ -59,7 +64,7 @@ def list( ) -> AsyncIterable["_models.AzureBackupJobResource"]: """Returns list of jobs belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -74,8 +79,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.AzureBackupJobResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -98,16 +105,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -115,13 +129,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AzureBackupJobResourceList", 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 @@ -134,7 +148,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs" + } @distributed_trace_async async def get( @@ -142,7 +158,7 @@ async def get( ) -> _models.AzureBackupJobResource: """Gets a job with id in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -166,8 +182,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.AzureBackupJobResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -180,9 +198,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 ) @@ -199,4 +217,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py index 7c6b68873ae1..88c8e69bc1ac 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_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 ( @@ -27,6 +28,10 @@ from ..._vendor import _convert_request from ...operations._operation_result_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(self, operation_id: str, location: str, **kwargs: Any) -> Optional _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.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -89,9 +96,9 @@ async def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional 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(self, operation_id: str, location: str, **kwargs: Any) -> Optional return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py index b52b3bc25940..f4312a59d6c5 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_backup_vault_context_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._operation_status_backup_vault_context_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]] @@ -58,7 +63,7 @@ async def get( Gets the operation status for an operation over a BackupVault's context. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -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.OperationResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_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 ) @@ -114,4 +121,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py index 02f56b65bd62..870acdeb1e1a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_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._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]] @@ -76,8 +81,10 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. _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.OperationResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( location=location, @@ -89,9 +96,9 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. 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 ) @@ -108,4 +115,6 @@ async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models. return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py index ee81a9579659..4e8793cf8861 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_operation_status_resource_group_context_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._operation_status_resource_group_context_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]] @@ -56,7 +61,7 @@ async def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) Gets the operation status for an operation over a ResourceGroup's context. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param operation_id: Required. @@ -77,8 +82,10 @@ async def get(self, resource_group_name: str, operation_id: str, **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.OperationResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -90,9 +97,9 @@ async def get(self, resource_group_name: str, operation_id: str, **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 = 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 get(self, resource_group_name: str, operation_id: str, **kwargs: Any) return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py index f629ed0b5771..ccc3f1dcd882 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_recovery_points_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -30,6 +31,10 @@ from ..._vendor import _convert_request from ...operations._recovery_points_operations import build_get_request, 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]] @@ -65,7 +70,7 @@ def list( ) -> AsyncIterable["_models.AzureBackupRecoveryPointResource"]: """Returns a list of Recovery Points for a DataSource in a vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -86,8 +91,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.AzureBackupRecoveryPointResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -113,16 +120,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -130,13 +144,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", 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 @@ -149,7 +163,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints" + } @distributed_trace_async async def get( @@ -162,7 +178,7 @@ async def get( ) -> _models.AzureBackupRecoveryPointResource: """Gets a Recovery Point using recoveryPointId for a Datasource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -187,8 +203,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.AzureBackupRecoveryPointResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -202,9 +220,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 ) @@ -221,4 +239,6 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py index bf0aa57dab1e..82028cb51fc7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_resource_guards_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( @@ -49,6 +50,10 @@ build_put_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 get_resources_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models _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.ResourceGuardResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -110,16 +117,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -127,13 +141,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceGuardResourceList", 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,7 +160,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_resources_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards"} # type: ignore + get_resources_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards" + } @distributed_trace def get_resources_in_resource_group( @@ -156,7 +172,7 @@ def get_resources_in_resource_group( Returns ResourceGuards collection belonging to a ResourceGroup. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -169,8 +185,10 @@ def get_resources_in_resource_group( _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.ResourceGuardResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -192,16 +210,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -209,13 +234,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("ResourceGuardResourceList", 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 @@ -228,7 +253,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_resources_in_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards"} # type: ignore + get_resources_in_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards" + } @overload async def put( @@ -244,7 +271,7 @@ async def put( Creates or updates a ResourceGuard resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -274,7 +301,7 @@ async def put( Creates or updates a ResourceGuard resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -302,7 +329,7 @@ async def put( Creates or updates a ResourceGuard resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -328,9 +355,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.ResourceGuardResource] + api_version: Literal["2022-12-01"] = 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.ResourceGuardResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -353,9 +382,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 ) @@ -372,7 +401,9 @@ async def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + } @distributed_trace_async async def get( @@ -382,7 +413,7 @@ async def get( Returns a ResourceGuard belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -403,8 +434,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.ResourceGuardResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -416,9 +449,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 ) @@ -435,7 +468,9 @@ async def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + } @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements @@ -445,7 +480,7 @@ async def delete( # pylint: disable=inconsistent-return-statements Deletes a ResourceGuard resource from the resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -466,8 +501,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -479,9 +516,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 ) @@ -494,14 +531,16 @@ async def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + } @overload async def patch( self, resource_group_name: str, resource_guards_name: str, - parameters: _models.PatchResourceRequestInput, + parameters: _models.PatchResourceGuardInput, *, content_type: str = "application/json", **kwargs: Any @@ -512,13 +551,13 @@ async def patch( Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. :type resource_guards_name: str :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -544,7 +583,7 @@ async def patch( Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -565,7 +604,7 @@ async def patch( self, resource_group_name: str, resource_guards_name: str, - parameters: Union[_models.PatchResourceRequestInput, IO], + parameters: Union[_models.PatchResourceGuardInput, IO], **kwargs: Any ) -> _models.ResourceGuardResource: """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for @@ -574,13 +613,13 @@ async def patch( Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. :type resource_guards_name: str :param parameters: Request body for operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput or IO + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -600,9 +639,11 @@ async def patch( _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.ResourceGuardResource] + api_version: Literal["2022-12-01"] = 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.ResourceGuardResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -610,7 +651,7 @@ async def patch( if isinstance(parameters, (IO, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "PatchResourceRequestInput") + _json = self._serialize.body(parameters, "PatchResourceGuardInput") request = build_patch_request( resource_group_name=resource_group_name, @@ -625,9 +666,9 @@ async def patch( 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 ) @@ -644,7 +685,9 @@ async def patch( return deserialized - patch.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + } @distributed_trace def get_disable_soft_delete_requests_objects( @@ -656,7 +699,7 @@ def get_disable_soft_delete_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -670,8 +713,10 @@ def get_disable_soft_delete_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -694,16 +739,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -711,13 +763,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -730,7 +782,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_disable_soft_delete_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests"} # type: ignore + get_disable_soft_delete_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests" + } @distributed_trace def get_delete_resource_guard_proxy_requests_objects( @@ -742,7 +796,7 @@ def get_delete_resource_guard_proxy_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -756,8 +810,10 @@ def get_delete_resource_guard_proxy_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -780,16 +836,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -797,13 +860,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -816,7 +879,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_delete_resource_guard_proxy_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests"} # type: ignore + get_delete_resource_guard_proxy_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests" + } @distributed_trace def get_backup_security_pin_requests_objects( @@ -828,7 +893,7 @@ def get_backup_security_pin_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -842,8 +907,10 @@ def get_backup_security_pin_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -866,16 +933,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -883,13 +957,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -902,7 +976,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_backup_security_pin_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests"} # type: ignore + get_backup_security_pin_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests" + } @distributed_trace def get_delete_protected_item_requests_objects( @@ -914,7 +990,7 @@ def get_delete_protected_item_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -928,8 +1004,10 @@ def get_delete_protected_item_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -952,16 +1030,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -969,13 +1054,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -988,7 +1073,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_delete_protected_item_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests"} # type: ignore + get_delete_protected_item_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests" + } @distributed_trace def get_update_protection_policy_requests_objects( @@ -1000,7 +1087,7 @@ def get_update_protection_policy_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1014,8 +1101,10 @@ def get_update_protection_policy_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1038,16 +1127,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1055,13 +1151,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -1074,7 +1170,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_update_protection_policy_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests"} # type: ignore + get_update_protection_policy_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests" + } @distributed_trace def get_update_protected_item_requests_objects( @@ -1086,7 +1184,7 @@ def get_update_protected_item_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1100,8 +1198,10 @@ def get_update_protected_item_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1124,16 +1224,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1141,13 +1248,13 @@ async def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -1160,7 +1267,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - get_update_protected_item_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests"} # type: ignore + get_update_protected_item_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests" + } @distributed_trace_async async def get_default_disable_soft_delete_requests_object( @@ -1172,7 +1281,7 @@ async def get_default_disable_soft_delete_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1195,8 +1304,10 @@ async def get_default_disable_soft_delete_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_disable_soft_delete_requests_object_request( resource_group_name=resource_group_name, @@ -1209,9 +1320,9 @@ async def get_default_disable_soft_delete_requests_object( 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 ) @@ -1228,7 +1339,9 @@ async def get_default_disable_soft_delete_requests_object( return deserialized - get_default_disable_soft_delete_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}"} # type: ignore + get_default_disable_soft_delete_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}" + } @distributed_trace_async async def get_default_delete_resource_guard_proxy_requests_object( @@ -1240,7 +1353,7 @@ async def get_default_delete_resource_guard_proxy_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1263,8 +1376,10 @@ async def get_default_delete_resource_guard_proxy_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_resource_guard_proxy_requests_object_request( resource_group_name=resource_group_name, @@ -1277,9 +1392,9 @@ async def get_default_delete_resource_guard_proxy_requests_object( 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 ) @@ -1296,7 +1411,9 @@ async def get_default_delete_resource_guard_proxy_requests_object( return deserialized - get_default_delete_resource_guard_proxy_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}"} # type: ignore + get_default_delete_resource_guard_proxy_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}" + } @distributed_trace_async async def get_default_backup_security_pin_requests_object( @@ -1308,7 +1425,7 @@ async def get_default_backup_security_pin_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1331,8 +1448,10 @@ async def get_default_backup_security_pin_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_backup_security_pin_requests_object_request( resource_group_name=resource_group_name, @@ -1345,9 +1464,9 @@ async def get_default_backup_security_pin_requests_object( 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 ) @@ -1364,7 +1483,9 @@ async def get_default_backup_security_pin_requests_object( return deserialized - get_default_backup_security_pin_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}"} # type: ignore + get_default_backup_security_pin_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}" + } @distributed_trace_async async def get_default_delete_protected_item_requests_object( @@ -1376,7 +1497,7 @@ async def get_default_delete_protected_item_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1399,8 +1520,10 @@ async def get_default_delete_protected_item_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_protected_item_requests_object_request( resource_group_name=resource_group_name, @@ -1413,9 +1536,9 @@ async def get_default_delete_protected_item_requests_object( 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 ) @@ -1432,7 +1555,9 @@ async def get_default_delete_protected_item_requests_object( return deserialized - get_default_delete_protected_item_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}"} # type: ignore + get_default_delete_protected_item_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}" + } @distributed_trace_async async def get_default_update_protection_policy_requests_object( @@ -1444,7 +1569,7 @@ async def get_default_update_protection_policy_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1467,8 +1592,10 @@ async def get_default_update_protection_policy_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protection_policy_requests_object_request( resource_group_name=resource_group_name, @@ -1481,9 +1608,9 @@ async def get_default_update_protection_policy_requests_object( 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 ) @@ -1500,7 +1627,9 @@ async def get_default_update_protection_policy_requests_object( return deserialized - get_default_update_protection_policy_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}"} # type: ignore + get_default_update_protection_policy_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}" + } @distributed_trace_async async def get_default_update_protected_item_requests_object( @@ -1512,7 +1641,7 @@ async def get_default_update_protected_item_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1535,8 +1664,10 @@ async def get_default_update_protected_item_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protected_item_requests_object_request( resource_group_name=resource_group_name, @@ -1549,9 +1680,9 @@ async def get_default_update_protected_item_requests_object( 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 ) @@ -1568,4 +1699,6 @@ async def get_default_update_protected_item_requests_object( return deserialized - get_default_update_protected_item_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}"} # type: ignore + get_default_update_protected_item_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py index 83724b98ace5..4b6c4a69f220 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/aio/operations/_restorable_time_ranges_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._restorable_time_ranges_operations import build_find_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]] @@ -63,7 +68,7 @@ async def find( ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: """find. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -94,7 +99,7 @@ async def find( ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: """find. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -123,7 +128,7 @@ async def find( ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: """find. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -152,9 +157,11 @@ async def find( _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.AzureBackupFindRestorableTimeRangesResponseResource] + api_version: Literal["2022-12-01"] = 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.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -178,9 +185,9 @@ async def find( 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 ) @@ -197,4 +204,6 @@ async def find( return deserialized - find.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges"} # type: ignore + find.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py index 5b69d18ca804..7d540f377059 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/__init__.py @@ -57,6 +57,7 @@ from ._models_py3 import ClientDiscoveryValueForSingleApi from ._models_py3 import CopyOnExpiryOption from ._models_py3 import CopyOption +from ._models_py3 import CrossSubscriptionRestoreSettings from ._models_py3 import CustomCopyOption from ._models_py3 import DataStoreInfoBase from ._models_py3 import DataStoreParameters @@ -70,6 +71,7 @@ from ._models_py3 import DeletionInfo from ._models_py3 import DppBaseResource from ._models_py3 import DppBaseResourceList +from ._models_py3 import DppBaseTrackedResource from ._models_py3 import DppIdentityDetails from ._models_py3 import DppProxyResource from ._models_py3 import DppResource @@ -80,6 +82,7 @@ from ._models_py3 import Error from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ExportJobsResult +from ._models_py3 import FeatureSettings from ._models_py3 import FeatureValidationRequest from ._models_py3 import FeatureValidationRequestBase from ._models_py3 import FeatureValidationResponse @@ -98,6 +101,7 @@ from ._models_py3 import OperationJobExtendedInfo from ._models_py3 import OperationResource from ._models_py3 import PatchBackupVaultInput +from ._models_py3 import PatchResourceGuardInput from ._models_py3 import PatchResourceRequestInput from ._models_py3 import PolicyInfo from ._models_py3 import PolicyParameters @@ -107,10 +111,6 @@ from ._models_py3 import RecoveryPointsFilters from ._models_py3 import ResourceGuard from ._models_py3 import ResourceGuardOperation -from ._models_py3 import ResourceGuardOperationDetail -from ._models_py3 import ResourceGuardProxyBase -from ._models_py3 import ResourceGuardProxyBaseResource -from ._models_py3 import ResourceGuardProxyBaseResourceList from ._models_py3 import ResourceGuardResource from ._models_py3 import ResourceGuardResourceList from ._models_py3 import ResourceMoveDetails @@ -136,8 +136,6 @@ from ._models_py3 import TargetDetails from ._models_py3 import TriggerBackupRequest from ._models_py3 import TriggerContext -from ._models_py3 import UnlockDeleteRequest -from ._models_py3 import UnlockDeleteResponse from ._models_py3 import UserFacingError from ._models_py3 import ValidateForBackupRequest from ._models_py3 import ValidateRestoreRequestObject @@ -145,6 +143,7 @@ from ._data_protection_client_enums import AbsoluteMarker from ._data_protection_client_enums import AlertsState from ._data_protection_client_enums import CreatedByType +from ._data_protection_client_enums import CrossSubscriptionRestoreState from ._data_protection_client_enums import CurrentProtectionState from ._data_protection_client_enums import DataStoreTypes from ._data_protection_client_enums import DayOfWeek @@ -156,7 +155,6 @@ from ._data_protection_client_enums import RecoveryOption from ._data_protection_client_enums import RehydrationPriority from ._data_protection_client_enums import RehydrationStatus -from ._data_protection_client_enums import ResourceGuardProvisioningState from ._data_protection_client_enums import ResourceMoveState from ._data_protection_client_enums import RestoreSourceDataStoreType from ._data_protection_client_enums import RestoreTargetLocationType @@ -170,7 +168,7 @@ from ._data_protection_client_enums import ValidationType from ._data_protection_client_enums import WeekNumber 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__ = [ @@ -225,6 +223,7 @@ "ClientDiscoveryValueForSingleApi", "CopyOnExpiryOption", "CopyOption", + "CrossSubscriptionRestoreSettings", "CustomCopyOption", "DataStoreInfoBase", "DataStoreParameters", @@ -238,6 +237,7 @@ "DeletionInfo", "DppBaseResource", "DppBaseResourceList", + "DppBaseTrackedResource", "DppIdentityDetails", "DppProxyResource", "DppResource", @@ -248,6 +248,7 @@ "Error", "ErrorAdditionalInfo", "ExportJobsResult", + "FeatureSettings", "FeatureValidationRequest", "FeatureValidationRequestBase", "FeatureValidationResponse", @@ -266,6 +267,7 @@ "OperationJobExtendedInfo", "OperationResource", "PatchBackupVaultInput", + "PatchResourceGuardInput", "PatchResourceRequestInput", "PolicyInfo", "PolicyParameters", @@ -275,10 +277,6 @@ "RecoveryPointsFilters", "ResourceGuard", "ResourceGuardOperation", - "ResourceGuardOperationDetail", - "ResourceGuardProxyBase", - "ResourceGuardProxyBaseResource", - "ResourceGuardProxyBaseResourceList", "ResourceGuardResource", "ResourceGuardResourceList", "ResourceMoveDetails", @@ -304,14 +302,13 @@ "TargetDetails", "TriggerBackupRequest", "TriggerContext", - "UnlockDeleteRequest", - "UnlockDeleteResponse", "UserFacingError", "ValidateForBackupRequest", "ValidateRestoreRequestObject", "AbsoluteMarker", "AlertsState", "CreatedByType", + "CrossSubscriptionRestoreState", "CurrentProtectionState", "DataStoreTypes", "DayOfWeek", @@ -323,7 +320,6 @@ "RecoveryOption", "RehydrationPriority", "RehydrationStatus", - "ResourceGuardProvisioningState", "ResourceMoveState", "RestoreSourceDataStoreType", "RestoreTargetLocationType", diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py index d4d6b7def37b..1bd383871375 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_data_protection_client_enums.py @@ -36,6 +36,14 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class CrossSubscriptionRestoreState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """CrossSubscriptionRestore state.""" + + DISABLED = "Disabled" + PERMANENTLY_DISABLED = "PermanentlyDisabled" + ENABLED = "Enabled" + + class CurrentProtectionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the current protection state of the resource.""" @@ -150,16 +158,6 @@ class RehydrationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): FAILED = "FAILED" -class ResourceGuardProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Provisioning state of the BackupVault resource.""" - - FAILED = "Failed" - PROVISIONING = "Provisioning" - SUCCEEDED = "Succeeded" - UNKNOWN = "Unknown" - UPDATING = "Updating" - - class ResourceMoveState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource move state for backup vault.""" @@ -217,6 +215,7 @@ class SourceDataStoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): ARCHIVE_STORE = "ArchiveStore" SNAPSHOT_STORE = "SnapshotStore" + OPERATIONAL_STORE = "OperationalStore" VAULT_STORE = "VaultStore" @@ -235,7 +234,7 @@ class StorageSettingStoreTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Gets or sets the type of the datastore.""" ARCHIVE_STORE = "ArchiveStore" - SNAPSHOT_STORE = "SnapshotStore" + OPERATIONAL_STORE = "OperationalStore" VAULT_STORE = "VaultStore" diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py index c14b1a8877f8..75bda2235e05 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/models/_models_py3.py @@ -50,7 +50,7 @@ def __init__(self, *, duration: str, **kwargs): """ super().__init__(**kwargs) self.duration = duration - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AbsoluteDeleteOption(DeleteOption): @@ -80,7 +80,7 @@ def __init__(self, *, duration: str, **kwargs): :paramtype duration: str """ super().__init__(duration=duration, **kwargs) - self.object_type = "AbsoluteDeleteOption" # type: str + self.object_type: str = "AbsoluteDeleteOption" class AdHocBackupRuleOptions(_serialization.Model): @@ -186,7 +186,7 @@ class TriggerContext(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AdhocBasedTriggerContext(TriggerContext): @@ -217,7 +217,7 @@ def __init__(self, *, tagging_criteria: "_models.AdhocBasedTaggingCriteria", **k :paramtype tagging_criteria: ~azure.mgmt.dataprotection.models.AdhocBasedTaggingCriteria """ super().__init__(**kwargs) - self.object_type = "AdhocBasedTriggerContext" # type: str + self.object_type: str = "AdhocBasedTriggerContext" self.tagging_criteria = tagging_criteria @@ -246,7 +246,7 @@ class AuthCredentials(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureBackupRecoveryPoint(_serialization.Model): @@ -274,12 +274,14 @@ class AzureBackupRecoveryPoint(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None -class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): +class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): # pylint: disable=too-many-instance-attributes """Azure backup discrete RecoveryPoint. + Variables are only populated by the server, and will be ignored when sending a request. + All required parameters must be populated in order to send to Azure. :ivar object_type: Required. @@ -303,11 +305,14 @@ class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): :vartype retention_tag_name: str :ivar retention_tag_version: :vartype retention_tag_version: str + :ivar expiry_time: + :vartype expiry_time: ~datetime.datetime """ _validation = { "object_type": {"required": True}, "recovery_point_time": {"required": True}, + "expiry_time": {"readonly": True}, } _attribute_map = { @@ -324,6 +329,7 @@ class AzureBackupDiscreteRecoveryPoint(AzureBackupRecoveryPoint): "recovery_point_type": {"key": "recoveryPointType", "type": "str"}, "retention_tag_name": {"key": "retentionTagName", "type": "str"}, "retention_tag_version": {"key": "retentionTagVersion", "type": "str"}, + "expiry_time": {"key": "expiryTime", "type": "iso-8601"}, } def __init__( @@ -362,7 +368,7 @@ def __init__( :paramtype retention_tag_version: str """ super().__init__(**kwargs) - self.object_type = "AzureBackupDiscreteRecoveryPoint" # type: str + self.object_type: str = "AzureBackupDiscreteRecoveryPoint" self.friendly_name = friendly_name self.recovery_point_data_stores_details = recovery_point_data_stores_details self.recovery_point_time = recovery_point_time @@ -372,6 +378,7 @@ def __init__( self.recovery_point_type = recovery_point_type self.retention_tag_name = retention_tag_name self.retention_tag_version = retention_tag_version + self.expiry_time = None class AzureBackupFindRestorableTimeRangesRequest(_serialization.Model): @@ -1053,7 +1060,7 @@ class BackupParameters(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureBackupParams(BackupParameters): @@ -1083,7 +1090,7 @@ def __init__(self, *, backup_type: str, **kwargs): :paramtype backup_type: str """ super().__init__(**kwargs) - self.object_type = "AzureBackupParams" # type: str + self.object_type: str = "AzureBackupParams" self.backup_type = backup_type @@ -1100,7 +1107,7 @@ class AzureBackupRestoreRequest(_serialization.Model): :ivar restore_target_info: Gets or sets the restore target information. Required. :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "ArchiveStore", "SnapshotStore", and "VaultStore". + values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. @@ -1139,14 +1146,14 @@ def __init__( :keyword restore_target_info: Gets or sets the restore target information. Required. :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "ArchiveStore", "SnapshotStore", and "VaultStore". + Known values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. :paramtype source_resource_id: str """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None self.restore_target_info = restore_target_info self.source_data_store_type = source_data_store_type self.source_resource_id = source_resource_id @@ -1165,7 +1172,7 @@ class AzureBackupRecoveryPointBasedRestoreRequest(AzureBackupRestoreRequest): :ivar restore_target_info: Gets or sets the restore target information. Required. :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "ArchiveStore", "SnapshotStore", and "VaultStore". + values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. @@ -1206,7 +1213,7 @@ def __init__( :keyword restore_target_info: Gets or sets the restore target information. Required. :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "ArchiveStore", "SnapshotStore", and "VaultStore". + Known values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. @@ -1220,7 +1227,7 @@ def __init__( source_resource_id=source_resource_id, **kwargs ) - self.object_type = "AzureBackupRecoveryPointBasedRestoreRequest" # type: str + self.object_type: str = "AzureBackupRecoveryPointBasedRestoreRequest" self.recovery_point_id = recovery_point_id @@ -1309,7 +1316,7 @@ class AzureBackupRecoveryTimeBasedRestoreRequest(AzureBackupRestoreRequest): :ivar restore_target_info: Gets or sets the restore target information. Required. :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "ArchiveStore", "SnapshotStore", and "VaultStore". + values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. @@ -1347,7 +1354,7 @@ def __init__( :keyword restore_target_info: Gets or sets the restore target information. Required. :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "ArchiveStore", "SnapshotStore", and "VaultStore". + Known values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. @@ -1362,7 +1369,7 @@ def __init__( source_resource_id=source_resource_id, **kwargs ) - self.object_type = "AzureBackupRecoveryTimeBasedRestoreRequest" # type: str + self.object_type: str = "AzureBackupRecoveryTimeBasedRestoreRequest" self.recovery_point_time = recovery_point_time @@ -1426,7 +1433,7 @@ class AzureBackupRestoreWithRehydrationRequest(AzureBackupRecoveryPointBasedRest :ivar restore_target_info: Gets or sets the restore target information. Required. :vartype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase :ivar source_data_store_type: Gets or sets the type of the source data store. Required. Known - values are: "ArchiveStore", "SnapshotStore", and "VaultStore". + values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". :vartype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType :ivar source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. @@ -1475,7 +1482,7 @@ def __init__( :keyword restore_target_info: Gets or sets the restore target information. Required. :paramtype restore_target_info: ~azure.mgmt.dataprotection.models.RestoreTargetInfoBase :keyword source_data_store_type: Gets or sets the type of the source data store. Required. - Known values are: "ArchiveStore", "SnapshotStore", and "VaultStore". + Known values are: "ArchiveStore", "SnapshotStore", "OperationalStore", and "VaultStore". :paramtype source_data_store_type: str or ~azure.mgmt.dataprotection.models.SourceDataStoreType :keyword source_resource_id: Fully qualified Azure Resource Manager ID of the datasource which is being recovered. @@ -1496,7 +1503,7 @@ def __init__( recovery_point_id=recovery_point_id, **kwargs ) - self.object_type = "AzureBackupRestoreWithRehydrationRequest" # type: str + self.object_type: str = "AzureBackupRestoreWithRehydrationRequest" self.rehydration_priority = rehydration_priority self.rehydration_retention_duration = rehydration_retention_duration @@ -1534,7 +1541,7 @@ def __init__(self, *, name: str, **kwargs): """ super().__init__(**kwargs) self.name = name - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class AzureBackupRule(BasePolicyRule): @@ -1589,7 +1596,7 @@ def __init__( :paramtype trigger: ~azure.mgmt.dataprotection.models.TriggerContext """ super().__init__(name=name, **kwargs) - self.object_type = "AzureBackupRule" # type: str + self.object_type: str = "AzureBackupRule" self.backup_parameters = backup_parameters self.data_store = data_store self.trigger = trigger @@ -1649,7 +1656,7 @@ def __init__(self, *, data_store_type: Union[str, "_models.DataStoreTypes"], **k :paramtype data_store_type: str or ~azure.mgmt.dataprotection.models.DataStoreTypes """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None self.data_store_type = data_store_type @@ -1693,7 +1700,7 @@ def __init__( :paramtype resource_group_id: str """ super().__init__(data_store_type=data_store_type, **kwargs) - self.object_type = "AzureOperationalStoreParameters" # type: str + self.object_type: str = "AzureOperationalStoreParameters" self.resource_group_id = resource_group_id @@ -1737,7 +1744,7 @@ def __init__( :paramtype lifecycles: list[~azure.mgmt.dataprotection.models.SourceLifeCycle] """ super().__init__(name=name, **kwargs) - self.object_type = "AzureRetentionRule" # type: str + self.object_type: str = "AzureRetentionRule" self.is_default = is_default self.lifecycles = lifecycles @@ -1767,7 +1774,7 @@ class BackupCriteria(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class BackupInstance(_serialization.Model): # pylint: disable=too-many-instance-attributes @@ -2040,7 +2047,7 @@ def __init__(self, *, datasource_types: List[str], **kwargs): """ super().__init__(**kwargs) self.datasource_types = datasource_types - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class BackupPolicy(BaseBackupPolicy): @@ -2078,7 +2085,7 @@ def __init__(self, *, datasource_types: List[str], policy_rules: List["_models.B :paramtype policy_rules: list[~azure.mgmt.dataprotection.models.BasePolicyRule] """ super().__init__(datasource_types=datasource_types, **kwargs) - self.object_type = "BackupPolicy" # type: str + self.object_type: str = "BackupPolicy" self.policy_rules = policy_rules @@ -2138,6 +2145,8 @@ class BackupVault(_serialization.Model): :vartype storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] :ivar is_vault_protected_by_resource_guard: Is vault protected by resource guard. :vartype is_vault_protected_by_resource_guard: bool + :ivar feature_settings: Feature Settings. + :vartype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings """ _validation = { @@ -2145,6 +2154,7 @@ class BackupVault(_serialization.Model): "resource_move_state": {"readonly": True}, "resource_move_details": {"readonly": True}, "storage_settings": {"required": True}, + "is_vault_protected_by_resource_guard": {"readonly": True}, } _attribute_map = { @@ -2155,6 +2165,7 @@ class BackupVault(_serialization.Model): "security_settings": {"key": "securitySettings", "type": "SecuritySettings"}, "storage_settings": {"key": "storageSettings", "type": "[StorageSetting]"}, "is_vault_protected_by_resource_guard": {"key": "isVaultProtectedByResourceGuard", "type": "bool"}, + "feature_settings": {"key": "featureSettings", "type": "FeatureSettings"}, } def __init__( @@ -2163,7 +2174,7 @@ def __init__( storage_settings: List["_models.StorageSetting"], monitoring_settings: Optional["_models.MonitoringSettings"] = None, security_settings: Optional["_models.SecuritySettings"] = None, - is_vault_protected_by_resource_guard: Optional[bool] = None, + feature_settings: Optional["_models.FeatureSettings"] = None, **kwargs ): """ @@ -2173,8 +2184,8 @@ def __init__( :paramtype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings :keyword storage_settings: Storage Settings. Required. :paramtype storage_settings: list[~azure.mgmt.dataprotection.models.StorageSetting] - :keyword is_vault_protected_by_resource_guard: Is vault protected by resource guard. - :paramtype is_vault_protected_by_resource_guard: bool + :keyword feature_settings: Feature Settings. + :paramtype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings """ super().__init__(**kwargs) self.monitoring_settings = monitoring_settings @@ -2183,11 +2194,12 @@ def __init__( self.resource_move_details = None self.security_settings = security_settings self.storage_settings = storage_settings - self.is_vault_protected_by_resource_guard = is_vault_protected_by_resource_guard + self.is_vault_protected_by_resource_guard = None + self.feature_settings = feature_settings -class DppTrackedResource(_serialization.Model): - """DppTrackedResource. +class DppBaseTrackedResource(_serialization.Model): + """DppBaseTrackedResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -2195,8 +2207,6 @@ class DppTrackedResource(_serialization.Model): :vartype e_tag: str :ivar id: Resource Id represents the complete path to the resource. :vartype id: str - :ivar identity: Input Managed Identity Details. - :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails :ivar location: Resource location. :vartype location: str :ivar name: Resource name associated with the resource. @@ -2220,7 +2230,6 @@ class DppTrackedResource(_serialization.Model): _attribute_map = { "e_tag": {"key": "eTag", "type": "str"}, "id": {"key": "id", "type": "str"}, - "identity": {"key": "identity", "type": "DppIdentityDetails"}, "location": {"key": "location", "type": "str"}, "name": {"key": "name", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, @@ -2232,7 +2241,6 @@ def __init__( self, *, e_tag: Optional[str] = None, - identity: Optional["_models.DppIdentityDetails"] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs @@ -2240,8 +2248,6 @@ def __init__( """ :keyword e_tag: Optional ETag. :paramtype e_tag: str - :keyword identity: Input Managed Identity Details. - :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails :keyword location: Resource location. :paramtype location: str :keyword tags: Resource tags. @@ -2250,7 +2256,6 @@ def __init__( super().__init__(**kwargs) self.e_tag = e_tag self.id = None - self.identity = identity self.location = location self.name = None self.tags = tags @@ -2258,6 +2263,71 @@ def __init__( self.system_data = None +class DppTrackedResource(DppBaseTrackedResource): + """DppTrackedResource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar e_tag: Optional ETag. + :vartype e_tag: str + :ivar id: Resource Id represents the complete path to the resource. + :vartype id: str + :ivar location: Resource location. + :vartype location: str + :ivar name: Resource name associated with the resource. + :vartype name: str + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar type: Resource type represents the complete path of the form + Namespace/ResourceType/ResourceType/... + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar identity: Input Managed Identity Details. + :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "e_tag": {"key": "eTag", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "DppIdentityDetails"}, + } + + def __init__( + self, + *, + e_tag: Optional[str] = None, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.DppIdentityDetails"] = None, + **kwargs + ): + """ + :keyword e_tag: Optional ETag. + :paramtype e_tag: str + :keyword location: Resource location. + :paramtype location: str + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Input Managed Identity Details. + :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails + """ + super().__init__(e_tag=e_tag, location=location, tags=tags, **kwargs) + self.identity = identity + + class BackupVaultResource(DppTrackedResource): """Backup Vault Resource. @@ -2269,8 +2339,6 @@ class BackupVaultResource(DppTrackedResource): :vartype e_tag: str :ivar id: Resource Id represents the complete path to the resource. :vartype id: str - :ivar identity: Input Managed Identity Details. - :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails :ivar location: Resource location. :vartype location: str :ivar name: Resource name associated with the resource. @@ -2282,6 +2350,8 @@ class BackupVaultResource(DppTrackedResource): :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData + :ivar identity: Input Managed Identity Details. + :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails :ivar properties: BackupVaultResource properties. Required. :vartype properties: ~azure.mgmt.dataprotection.models.BackupVault """ @@ -2297,12 +2367,12 @@ class BackupVaultResource(DppTrackedResource): _attribute_map = { "e_tag": {"key": "eTag", "type": "str"}, "id": {"key": "id", "type": "str"}, - "identity": {"key": "identity", "type": "DppIdentityDetails"}, "location": {"key": "location", "type": "str"}, "name": {"key": "name", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "identity": {"key": "identity", "type": "DppIdentityDetails"}, "properties": {"key": "properties", "type": "BackupVault"}, } @@ -2311,24 +2381,24 @@ def __init__( *, properties: "_models.BackupVault", e_tag: Optional[str] = None, - identity: Optional["_models.DppIdentityDetails"] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.DppIdentityDetails"] = None, **kwargs ): """ :keyword e_tag: Optional ETag. :paramtype e_tag: str - :keyword identity: Input Managed Identity Details. - :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails :keyword location: Resource location. :paramtype location: str :keyword tags: Resource tags. :paramtype tags: dict[str, str] + :keyword identity: Input Managed Identity Details. + :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails :keyword properties: BackupVaultResource properties. Required. :paramtype properties: ~azure.mgmt.dataprotection.models.BackupVault """ - super().__init__(e_tag=e_tag, identity=identity, location=location, tags=tags, **kwargs) + super().__init__(e_tag=e_tag, location=location, tags=tags, identity=identity, **kwargs) self.properties = properties @@ -2752,7 +2822,7 @@ class CopyOption(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class CopyOnExpiryOption(CopyOption): @@ -2775,7 +2845,29 @@ class CopyOnExpiryOption(CopyOption): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = "CopyOnExpiryOption" # type: str + self.object_type: str = "CopyOnExpiryOption" + + +class CrossSubscriptionRestoreSettings(_serialization.Model): + """CrossSubscriptionRestore Settings. + + :ivar state: CrossSubscriptionRestore state. Known values are: "Disabled", + "PermanentlyDisabled", and "Enabled". + :vartype state: str or ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreState + """ + + _attribute_map = { + "state": {"key": "state", "type": "str"}, + } + + def __init__(self, *, state: Optional[Union[str, "_models.CrossSubscriptionRestoreState"]] = None, **kwargs): + """ + :keyword state: CrossSubscriptionRestore state. Known values are: "Disabled", + "PermanentlyDisabled", and "Enabled". + :paramtype state: str or ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreState + """ + super().__init__(**kwargs) + self.state = state class CustomCopyOption(CopyOption): @@ -2804,7 +2896,7 @@ def __init__(self, *, duration: Optional[str] = None, **kwargs): :paramtype duration: str """ super().__init__(**kwargs) - self.object_type = "CustomCopyOption" # type: str + self.object_type: str = "CustomCopyOption" self.duration = duration @@ -3478,6 +3570,36 @@ def __init__(self, **kwargs): self.excel_file_blob_sas_key = None +class FeatureSettings(_serialization.Model): + """Class containing feature settings of vault. + + :ivar cross_subscription_restore_settings: CrossSubscriptionRestore Settings. + :vartype cross_subscription_restore_settings: + ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreSettings + """ + + _attribute_map = { + "cross_subscription_restore_settings": { + "key": "crossSubscriptionRestoreSettings", + "type": "CrossSubscriptionRestoreSettings", + }, + } + + def __init__( + self, + *, + cross_subscription_restore_settings: Optional["_models.CrossSubscriptionRestoreSettings"] = None, + **kwargs + ): + """ + :keyword cross_subscription_restore_settings: CrossSubscriptionRestore Settings. + :paramtype cross_subscription_restore_settings: + ~azure.mgmt.dataprotection.models.CrossSubscriptionRestoreSettings + """ + super().__init__(**kwargs) + self.cross_subscription_restore_settings = cross_subscription_restore_settings + + class FeatureValidationRequestBase(_serialization.Model): """Base class for Backup Feature support. @@ -3503,7 +3625,7 @@ class FeatureValidationRequestBase(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class FeatureValidationRequest(FeatureValidationRequestBase): @@ -3545,7 +3667,7 @@ def __init__( :paramtype feature_name: str """ super().__init__(**kwargs) - self.object_type = "FeatureValidationRequest" # type: str + self.object_type: str = "FeatureValidationRequest" self.feature_type = feature_type self.feature_name = feature_name @@ -3575,7 +3697,7 @@ class FeatureValidationResponseBase(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class FeatureValidationResponse(FeatureValidationResponseBase): @@ -3617,7 +3739,7 @@ def __init__( :paramtype features: list[~azure.mgmt.dataprotection.models.SupportedFeature] """ super().__init__(**kwargs) - self.object_type = "FeatureValidationResponse" # type: str + self.object_type: str = "FeatureValidationResponse" self.feature_type = feature_type self.features = features @@ -3642,7 +3764,7 @@ class ImmediateCopyOption(CopyOption): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = "ImmediateCopyOption" # type: str + self.object_type: str = "ImmediateCopyOption" class ImmutabilitySettings(_serialization.Model): @@ -3738,7 +3860,7 @@ class ItemLevelRestoreCriteria(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class RestoreTargetInfoBase(_serialization.Model): @@ -3787,7 +3909,7 @@ def __init__( :paramtype restore_location: str """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None self.recovery_option = recovery_option self.restore_location = restore_location @@ -3859,7 +3981,7 @@ def __init__( :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials """ super().__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) - self.object_type = "ItemLevelRestoreTargetInfo" # type: str + self.object_type: str = "ItemLevelRestoreTargetInfo" self.restore_criteria = restore_criteria self.datasource_info = datasource_info self.datasource_set_info = datasource_set_info @@ -4013,7 +4135,7 @@ def __init__(self, *, name: Optional[str] = None, storage_class_name: Optional[s :paramtype storage_class_name: str """ super().__init__(**kwargs) - self.object_type = "KubernetesPVRestoreCriteria" # type: str + self.object_type: str = "KubernetesPVRestoreCriteria" self.name = name self.storage_class_name = storage_class_name @@ -4051,7 +4173,7 @@ def __init__( :paramtype provisioner: str """ super().__init__(**kwargs) - self.object_type = "KubernetesStorageClassRestoreCriteria" # type: str + self.object_type: str = "KubernetesStorageClassRestoreCriteria" self.selected_storage_class_name = selected_storage_class_name self.provisioner = provisioner @@ -4104,7 +4226,7 @@ class OperationExtendedInfo(_serialization.Model): def __init__(self, **kwargs): """ """ super().__init__(**kwargs) - self.object_type = None # type: Optional[str] + self.object_type: Optional[str] = None class OperationJobExtendedInfo(OperationExtendedInfo): @@ -4134,7 +4256,7 @@ def __init__(self, *, job_id: Optional[str] = None, **kwargs): :paramtype job_id: str """ super().__init__(**kwargs) - self.object_type = "OperationJobExtendedInfo" # type: str + self.object_type: str = "OperationJobExtendedInfo" self.job_id = job_id @@ -4220,11 +4342,14 @@ class PatchBackupVaultInput(_serialization.Model): :vartype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings :ivar security_settings: Security Settings. :vartype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings + :ivar feature_settings: Feature Settings. + :vartype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings """ _attribute_map = { "monitoring_settings": {"key": "monitoringSettings", "type": "MonitoringSettings"}, "security_settings": {"key": "securitySettings", "type": "SecuritySettings"}, + "feature_settings": {"key": "featureSettings", "type": "FeatureSettings"}, } def __init__( @@ -4232,6 +4357,7 @@ def __init__( *, monitoring_settings: Optional["_models.MonitoringSettings"] = None, security_settings: Optional["_models.SecuritySettings"] = None, + feature_settings: Optional["_models.FeatureSettings"] = None, **kwargs ): """ @@ -4239,10 +4365,33 @@ def __init__( :paramtype monitoring_settings: ~azure.mgmt.dataprotection.models.MonitoringSettings :keyword security_settings: Security Settings. :paramtype security_settings: ~azure.mgmt.dataprotection.models.SecuritySettings + :keyword feature_settings: Feature Settings. + :paramtype feature_settings: ~azure.mgmt.dataprotection.models.FeatureSettings """ super().__init__(**kwargs) self.monitoring_settings = monitoring_settings self.security_settings = security_settings + self.feature_settings = feature_settings + + +class PatchResourceGuardInput(_serialization.Model): + """Patch Request content for Microsoft.DataProtection Resource Guard resources. + + :ivar tags: Resource Guard tags. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + """ + :keyword tags: Resource Guard tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags class PatchResourceRequestInput(_serialization.Model): @@ -4412,7 +4561,7 @@ def __init__(self, *, min_matching_value: Optional[str] = None, max_matching_val :paramtype max_matching_value: str """ super().__init__(**kwargs) - self.object_type = "RangeBasedItemLevelRestoreCriteria" # type: str + self.object_type: str = "RangeBasedItemLevelRestoreCriteria" self.min_matching_value = min_matching_value self.max_matching_value = max_matching_value @@ -4567,8 +4716,7 @@ class ResourceGuard(_serialization.Model): :ivar provisioning_state: Provisioning state of the BackupVault resource. Known values are: "Failed", "Provisioning", "Succeeded", "Unknown", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.dataprotection.models.ResourceGuardProvisioningState + :vartype provisioning_state: str or ~azure.mgmt.dataprotection.models.ProvisioningState :ivar allow_auto_approvals: This flag indicates whether auto approval is allowed or not. :vartype allow_auto_approvals: bool :ivar resource_guard_operations: {readonly} List of operation details those are protected by @@ -4639,165 +4787,7 @@ def __init__(self, **kwargs): self.request_resource_type = None -class ResourceGuardOperationDetail(_serialization.Model): - """ResourceGuardOperationDetail. - - :ivar vault_critical_operation: - :vartype vault_critical_operation: str - :ivar default_resource_request: - :vartype default_resource_request: str - """ - - _attribute_map = { - "vault_critical_operation": {"key": "vaultCriticalOperation", "type": "str"}, - "default_resource_request": {"key": "defaultResourceRequest", "type": "str"}, - } - - def __init__( - self, - *, - vault_critical_operation: Optional[str] = None, - default_resource_request: Optional[str] = None, - **kwargs - ): - """ - :keyword vault_critical_operation: - :paramtype vault_critical_operation: str - :keyword default_resource_request: - :paramtype default_resource_request: str - """ - super().__init__(**kwargs) - self.vault_critical_operation = vault_critical_operation - self.default_resource_request = default_resource_request - - -class ResourceGuardProxyBase(_serialization.Model): - """ResourceGuardProxyBase. - - :ivar resource_guard_resource_id: - :vartype resource_guard_resource_id: str - :ivar resource_guard_operation_details: - :vartype resource_guard_operation_details: - list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] - :ivar last_updated_time: - :vartype last_updated_time: str - :ivar description: - :vartype description: str - """ - - _attribute_map = { - "resource_guard_resource_id": {"key": "resourceGuardResourceId", "type": "str"}, - "resource_guard_operation_details": { - "key": "resourceGuardOperationDetails", - "type": "[ResourceGuardOperationDetail]", - }, - "last_updated_time": {"key": "lastUpdatedTime", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - resource_guard_resource_id: Optional[str] = None, - resource_guard_operation_details: Optional[List["_models.ResourceGuardOperationDetail"]] = None, - last_updated_time: Optional[str] = None, - description: Optional[str] = None, - **kwargs - ): - """ - :keyword resource_guard_resource_id: - :paramtype resource_guard_resource_id: str - :keyword resource_guard_operation_details: - :paramtype resource_guard_operation_details: - list[~azure.mgmt.dataprotection.models.ResourceGuardOperationDetail] - :keyword last_updated_time: - :paramtype last_updated_time: str - :keyword description: - :paramtype description: str - """ - super().__init__(**kwargs) - self.resource_guard_resource_id = resource_guard_resource_id - self.resource_guard_operation_details = resource_guard_operation_details - self.last_updated_time = last_updated_time - self.description = description - - -class ResourceGuardProxyBaseResource(DppResource): - """ResourceGuardProxyBaseResource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Resource Id represents the complete path to the resource. - :vartype id: str - :ivar name: Resource name associated with the resource. - :vartype name: str - :ivar type: Resource type represents the complete path of the form - Namespace/ResourceType/ResourceType/... - :vartype type: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.dataprotection.models.SystemData - :ivar properties: ResourceGuardProxyBaseResource properties. - :vartype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ResourceGuardProxyBase"}, - } - - def __init__(self, *, properties: Optional["_models.ResourceGuardProxyBase"] = None, **kwargs): - """ - :keyword properties: ResourceGuardProxyBaseResource properties. - :paramtype properties: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBase - """ - super().__init__(**kwargs) - self.properties = properties - - -class ResourceGuardProxyBaseResourceList(DppResourceList): - """List of ResourceGuardProxyBase resources. - - :ivar next_link: The uri to fetch the next page of resources. Call ListNext() fetches next page - of resources. - :vartype next_link: str - :ivar value: List of resources. - :vartype value: list[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] - """ - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[ResourceGuardProxyBaseResource]"}, - } - - def __init__( - self, - *, - next_link: Optional[str] = None, - value: Optional[List["_models.ResourceGuardProxyBaseResource"]] = None, - **kwargs - ): - """ - :keyword next_link: The uri to fetch the next page of resources. Call ListNext() fetches next - page of resources. - :paramtype next_link: str - :keyword value: List of resources. - :paramtype value: list[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] - """ - super().__init__(next_link=next_link, **kwargs) - self.value = value - - -class ResourceGuardResource(DppTrackedResource): +class ResourceGuardResource(DppBaseTrackedResource): """ResourceGuardResource. Variables are only populated by the server, and will be ignored when sending a request. @@ -4806,8 +4796,6 @@ class ResourceGuardResource(DppTrackedResource): :vartype e_tag: str :ivar id: Resource Id represents the complete path to the resource. :vartype id: str - :ivar identity: Input Managed Identity Details. - :vartype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails :ivar location: Resource location. :vartype location: str :ivar name: Resource name associated with the resource. @@ -4833,7 +4821,6 @@ class ResourceGuardResource(DppTrackedResource): _attribute_map = { "e_tag": {"key": "eTag", "type": "str"}, "id": {"key": "id", "type": "str"}, - "identity": {"key": "identity", "type": "DppIdentityDetails"}, "location": {"key": "location", "type": "str"}, "name": {"key": "name", "type": "str"}, "tags": {"key": "tags", "type": "{str}"}, @@ -4846,7 +4833,6 @@ def __init__( self, *, e_tag: Optional[str] = None, - identity: Optional["_models.DppIdentityDetails"] = None, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, properties: Optional["_models.ResourceGuard"] = None, @@ -4855,8 +4841,6 @@ def __init__( """ :keyword e_tag: Optional ETag. :paramtype e_tag: str - :keyword identity: Input Managed Identity Details. - :paramtype identity: ~azure.mgmt.dataprotection.models.DppIdentityDetails :keyword location: Resource location. :paramtype location: str :keyword tags: Resource tags. @@ -4864,7 +4848,7 @@ def __init__( :keyword properties: ResourceGuardResource properties. :paramtype properties: ~azure.mgmt.dataprotection.models.ResourceGuard """ - super().__init__(e_tag=e_tag, identity=identity, location=location, tags=tags, **kwargs) + super().__init__(e_tag=e_tag, location=location, tags=tags, **kwargs) self.properties = properties @@ -5047,7 +5031,7 @@ def __init__( :paramtype target_details: ~azure.mgmt.dataprotection.models.TargetDetails """ super().__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) - self.object_type = "RestoreFilesTargetInfo" # type: str + self.object_type: str = "RestoreFilesTargetInfo" self.target_details = target_details @@ -5143,7 +5127,7 @@ def __init__( :paramtype datasource_auth_credentials: ~azure.mgmt.dataprotection.models.AuthCredentials """ super().__init__(recovery_option=recovery_option, restore_location=restore_location, **kwargs) - self.object_type = "RestoreTargetInfo" # type: str + self.object_type: str = "RestoreTargetInfo" self.datasource_info = datasource_info self.datasource_set_info = datasource_set_info self.datasource_auth_credentials = datasource_auth_credentials @@ -5252,7 +5236,7 @@ def __init__( :paramtype weeks_of_the_month: list[str or ~azure.mgmt.dataprotection.models.WeekNumber] """ super().__init__(**kwargs) - self.object_type = "ScheduleBasedBackupCriteria" # type: str + self.object_type: str = "ScheduleBasedBackupCriteria" self.absolute_criteria = absolute_criteria self.days_of_month = days_of_month self.days_of_the_week = days_of_the_week @@ -5296,7 +5280,7 @@ def __init__( :paramtype tagging_criteria: list[~azure.mgmt.dataprotection.models.TaggingCriteria] """ super().__init__(**kwargs) - self.object_type = "ScheduleBasedTriggerContext" # type: str + self.object_type: str = "ScheduleBasedTriggerContext" self.schedule = schedule self.tagging_criteria = tagging_criteria @@ -5327,7 +5311,7 @@ def __init__(self, *, secret_store_resource: Optional["_models.SecretStoreResour :paramtype secret_store_resource: ~azure.mgmt.dataprotection.models.SecretStoreResource """ super().__init__(**kwargs) - self.object_type = "SecretStoreBasedAuthCredentials" # type: str + self.object_type: str = "SecretStoreBasedAuthCredentials" self.secret_store_resource = secret_store_resource @@ -5494,7 +5478,7 @@ class StorageSetting(_serialization.Model): """Storage setting. :ivar datastore_type: Gets or sets the type of the datastore. Known values are: "ArchiveStore", - "SnapshotStore", and "VaultStore". + "OperationalStore", and "VaultStore". :vartype datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes :ivar type: Gets or sets the type. Known values are: "GeoRedundant", "LocallyRedundant", and "ZoneRedundant". @@ -5515,7 +5499,7 @@ def __init__( ): """ :keyword datastore_type: Gets or sets the type of the datastore. Known values are: - "ArchiveStore", "SnapshotStore", and "VaultStore". + "ArchiveStore", "OperationalStore", and "VaultStore". :paramtype datastore_type: str or ~azure.mgmt.dataprotection.models.StorageSettingStoreTypes :keyword type: Gets or sets the type. Known values are: "GeoRedundant", "LocallyRedundant", and "ZoneRedundant". @@ -5758,6 +5742,12 @@ class TargetDetails(_serialization.Model): :ivar url: Url denoting the restore destination. It can point to container / file share etc. Required. :vartype url: str + :ivar target_resource_arm_id: Full ARM Id denoting the restore destination. It is the ARM Id + pointing to container / file share + This is optional if the target subscription can be identified with the URL field. If not + then this is needed if CrossSubscriptionRestore field of BackupVault is in any of the disabled + states. + :vartype target_resource_arm_id: str """ _validation = { @@ -5770,6 +5760,7 @@ class TargetDetails(_serialization.Model): "file_prefix": {"key": "filePrefix", "type": "str"}, "restore_target_location_type": {"key": "restoreTargetLocationType", "type": "str"}, "url": {"key": "url", "type": "str"}, + "target_resource_arm_id": {"key": "targetResourceArmId", "type": "str"}, } def __init__( @@ -5778,6 +5769,7 @@ def __init__( file_prefix: str, restore_target_location_type: Union[str, "_models.RestoreTargetLocationType"], url: str, + target_resource_arm_id: Optional[str] = None, **kwargs ): """ @@ -5795,11 +5787,18 @@ def __init__( :keyword url: Url denoting the restore destination. It can point to container / file share etc. Required. :paramtype url: str + :keyword target_resource_arm_id: Full ARM Id denoting the restore destination. It is the ARM Id + pointing to container / file share + This is optional if the target subscription can be identified with the URL field. If not + then this is needed if CrossSubscriptionRestore field of BackupVault is in any of the disabled + states. + :paramtype target_resource_arm_id: str """ super().__init__(**kwargs) self.file_prefix = file_prefix self.restore_target_location_type = restore_target_location_type self.url = url + self.target_resource_arm_id = target_resource_arm_id class TriggerBackupRequest(_serialization.Model): @@ -5830,60 +5829,6 @@ def __init__(self, *, backup_rule_options: "_models.AdHocBackupRuleOptions", **k self.backup_rule_options = backup_rule_options -class UnlockDeleteRequest(_serialization.Model): - """Request body of unlock delete API. - - :ivar resource_guard_operation_requests: - :vartype resource_guard_operation_requests: list[str] - :ivar resource_to_be_deleted: - :vartype resource_to_be_deleted: str - """ - - _attribute_map = { - "resource_guard_operation_requests": {"key": "resourceGuardOperationRequests", "type": "[str]"}, - "resource_to_be_deleted": {"key": "resourceToBeDeleted", "type": "str"}, - } - - def __init__( - self, - *, - resource_guard_operation_requests: Optional[List[str]] = None, - resource_to_be_deleted: Optional[str] = None, - **kwargs - ): - """ - :keyword resource_guard_operation_requests: - :paramtype resource_guard_operation_requests: list[str] - :keyword resource_to_be_deleted: - :paramtype resource_to_be_deleted: str - """ - super().__init__(**kwargs) - self.resource_guard_operation_requests = resource_guard_operation_requests - self.resource_to_be_deleted = resource_to_be_deleted - - -class UnlockDeleteResponse(_serialization.Model): - """Response of Unlock Delete API. - - :ivar unlock_delete_expiry_time: This is the time when unlock delete privileges will get - expired. - :vartype unlock_delete_expiry_time: str - """ - - _attribute_map = { - "unlock_delete_expiry_time": {"key": "unlockDeleteExpiryTime", "type": "str"}, - } - - def __init__(self, *, unlock_delete_expiry_time: Optional[str] = None, **kwargs): - """ - :keyword unlock_delete_expiry_time: This is the time when unlock delete privileges will get - expired. - :paramtype unlock_delete_expiry_time: str - """ - super().__init__(**kwargs) - self.unlock_delete_expiry_time = unlock_delete_expiry_time - - class UserFacingError(_serialization.Model): """Error object used by layers that have access to localized content, and propagate that to user. diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py index 0685deeec279..6775e75af5a7 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/__init__.py @@ -16,7 +16,6 @@ from ._data_protection_operations_operations import DataProtectionOperationsOperations from ._backup_policies_operations import BackupPoliciesOperations from ._backup_instances_operations import BackupInstancesOperations -from ._backup_instances_extension_routing_operations import BackupInstancesExtensionRoutingOperations from ._recovery_points_operations import RecoveryPointsOperations from ._jobs_operations import JobsOperations from ._restorable_time_ranges_operations import RestorableTimeRangesOperations @@ -24,10 +23,9 @@ from ._export_jobs_operation_result_operations import ExportJobsOperationResultOperations from ._deleted_backup_instances_operations import DeletedBackupInstancesOperations from ._resource_guards_operations import ResourceGuardsOperations -from ._dpp_resource_guard_proxy_operations import DppResourceGuardProxyOperations 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__ = [ @@ -41,7 +39,6 @@ "DataProtectionOperationsOperations", "BackupPoliciesOperations", "BackupInstancesOperations", - "BackupInstancesExtensionRoutingOperations", "RecoveryPointsOperations", "JobsOperations", "RestorableTimeRangesOperations", @@ -49,7 +46,6 @@ "ExportJobsOperationResultOperations", "DeletedBackupInstancesOperations", "ResourceGuardsOperations", - "DppResourceGuardProxyOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py deleted file mode 100644 index 9e78b6dae6e0..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_extension_routing_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -from urllib.parse import parse_qs, urljoin, urlparse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_id: str, **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 - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/{resourceId}/providers/Microsoft.DataProtection/backupInstances") - path_format_arguments = { - "resourceId": _SERIALIZER.url("resource_id", resource_id, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class BackupInstancesExtensionRoutingOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s - :attr:`backup_instances_extension_routing` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_id: str, **kwargs: Any) -> Iterable["_models.BackupInstanceResource"]: - """Gets a list backup instances associated with a tracked resource. - - :param resource_id: ARM path of the resource to be protected using Microsoft.DataProtection. - Required. - :type resource_id: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either BackupInstanceResource or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.BackupInstanceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.BackupInstanceResourceList] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_id=resource_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", 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.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("BackupInstanceResourceList", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) - 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 - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/{resourceId}/providers/Microsoft.DataProtection/backupInstances"} # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py index 216b1acabc95..432f4d823b11 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_instances_operations.py @@ -6,8 +6,9 @@ # 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, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,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]] @@ -42,7 +47,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +57,13 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -73,7 +80,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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,12 +90,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -105,8 +114,8 @@ 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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -116,12 +125,14 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -140,7 +151,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -150,12 +161,14 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -172,8 +185,8 @@ def build_adhoc_backup_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -183,12 +196,14 @@ def build_adhoc_backup_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -207,8 +222,8 @@ def build_validate_for_backup_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -218,11 +233,13 @@ def build_validate_for_backup_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -246,7 +263,7 @@ def build_get_backup_instance_operation_result_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -256,13 +273,15 @@ def build_get_backup_instance_operation_result_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "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") @@ -279,8 +298,8 @@ def build_trigger_rehydrate_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -289,13 +308,15 @@ def build_trigger_rehydrate_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -314,8 +335,8 @@ def build_trigger_restore_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -325,12 +346,14 @@ def build_trigger_restore_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -349,7 +372,7 @@ def build_resume_backups_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -359,12 +382,14 @@ def build_resume_backups_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -381,7 +406,7 @@ def build_resume_protection_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -391,12 +416,14 @@ def build_resume_protection_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -413,7 +440,7 @@ def build_stop_protection_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -423,12 +450,14 @@ def build_stop_protection_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -445,7 +474,7 @@ def build_suspend_backups_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -455,12 +484,14 @@ def build_suspend_backups_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -477,8 +508,8 @@ def build_sync_backup_instance_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -488,12 +519,14 @@ def build_sync_backup_instance_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -512,8 +545,8 @@ def build_validate_for_restore_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -523,12 +556,14 @@ def build_validate_for_restore_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -566,7 +601,7 @@ def list( ) -> Iterable["_models.BackupInstanceResource"]: """Gets a backup instances belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -580,8 +615,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.BackupInstanceResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupInstanceResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -604,16 +641,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -621,13 +665,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupInstanceResourceList", 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 @@ -640,7 +684,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances" + } @distributed_trace def get( @@ -648,7 +694,7 @@ def get( ) -> _models.BackupInstanceResource: """Gets a backup instance with name in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -671,8 +717,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.BackupInstanceResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -685,9 +733,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 ) @@ -704,7 +752,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } def _create_or_update_initial( self, @@ -725,9 +775,11 @@ def _create_or_update_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[Optional[_models.BackupInstanceResource]] + api_version: Literal["2022-12-01"] = 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.BackupInstanceResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -751,9 +803,9 @@ def _create_or_update_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 ) @@ -782,7 +834,9 @@ def _create_or_update_initial( return deserialized - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } @overload def begin_create_or_update( @@ -797,7 +851,7 @@ def begin_create_or_update( ) -> LROPoller[_models.BackupInstanceResource]: """Create or update a backup instance in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -836,7 +890,7 @@ def begin_create_or_update( ) -> LROPoller[_models.BackupInstanceResource]: """Create or update a backup instance in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -873,7 +927,7 @@ def begin_create_or_update( ) -> LROPoller[_models.BackupInstanceResource]: """Create or update a backup instance in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -901,14 +955,16 @@ def begin_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.BackupInstanceResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-12-01"] = 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.BackupInstanceResource] = 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._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -929,7 +985,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: @@ -941,9 +997,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_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -959,8 +1017,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -973,9 +1033,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 ) @@ -996,7 +1056,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _delete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + _delete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } @distributed_trace def begin_delete( @@ -1004,7 +1066,7 @@ def begin_delete( ) -> LROPoller[None]: """Delete a backup instance in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1026,11 +1088,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-12-01"] = 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 resource_group_name=resource_group_name, @@ -1049,7 +1113,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: @@ -1061,9 +1125,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_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}"} # type: ignore + begin_delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}" + } def _adhoc_backup_initial( self, @@ -1084,9 +1150,11 @@ def _adhoc_backup_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1110,9 +1178,9 @@ def _adhoc_backup_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 ) @@ -1139,7 +1207,9 @@ def _adhoc_backup_initial( return deserialized - _adhoc_backup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup"} # type: ignore + _adhoc_backup_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup" + } @overload def begin_adhoc_backup( @@ -1154,7 +1224,7 @@ def begin_adhoc_backup( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Trigger adhoc backup. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1194,7 +1264,7 @@ def begin_adhoc_backup( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Trigger adhoc backup. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1232,7 +1302,7 @@ def begin_adhoc_backup( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Trigger adhoc backup. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1261,14 +1331,16 @@ def begin_adhoc_backup( _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.OperationJobExtendedInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo] = 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._adhoc_backup_initial( # type: ignore + raw_result = self._adhoc_backup_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -1289,7 +1361,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: @@ -1301,9 +1373,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_adhoc_backup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup"} # type: ignore + begin_adhoc_backup.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/backup" + } def _validate_for_backup_initial( self, @@ -1323,9 +1397,11 @@ def _validate_for_backup_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1348,9 +1424,9 @@ def _validate_for_backup_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 ) @@ -1377,7 +1453,9 @@ def _validate_for_backup_initial( return deserialized - _validate_for_backup_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup"} # type: ignore + _validate_for_backup_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup" + } @overload def begin_validate_for_backup( @@ -1391,7 +1469,7 @@ def begin_validate_for_backup( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Validate whether adhoc backup will be successful or not. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1428,7 +1506,7 @@ def begin_validate_for_backup( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Validate whether adhoc backup will be successful or not. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1463,7 +1541,7 @@ def begin_validate_for_backup( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Validate whether adhoc backup will be successful or not. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1490,14 +1568,16 @@ def begin_validate_for_backup( _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.OperationJobExtendedInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo] = 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._validate_for_backup_initial( # type: ignore + raw_result = self._validate_for_backup_initial( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, @@ -1517,7 +1597,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: @@ -1529,9 +1609,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_validate_for_backup.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup"} # type: ignore + begin_validate_for_backup.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/validateForBackup" + } @distributed_trace def get_backup_instance_operation_result( @@ -1539,12 +1621,12 @@ def get_backup_instance_operation_result( ) -> Optional[_models.BackupInstanceResource]: """Get result of backup instance creation operation. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param operation_id: Required. :type operation_id: str @@ -1564,8 +1646,10 @@ def get_backup_instance_operation_result( _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.BackupInstanceResource]] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.BackupInstanceResource]] = kwargs.pop("cls", None) request = build_get_backup_instance_operation_result_request( resource_group_name=resource_group_name, @@ -1579,9 +1663,9 @@ def get_backup_instance_operation_result( 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 ) @@ -1600,7 +1684,9 @@ def get_backup_instance_operation_result( return deserialized - get_backup_instance_operation_result.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}"} # type: ignore + get_backup_instance_operation_result.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/operationResults/{operationId}" + } def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statements self, @@ -1621,9 +1707,11 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement _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-12-01"] = 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 @@ -1647,9 +1735,9 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement 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 ) @@ -1670,7 +1758,9 @@ def _trigger_rehydrate_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, response_headers) - _trigger_rehydrate_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate"} # type: ignore + _trigger_rehydrate_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate" + } @overload def begin_trigger_rehydrate( @@ -1685,12 +1775,12 @@ def begin_trigger_rehydrate( ) -> LROPoller[None]: """rehydrate recovery point for restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Required. :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest @@ -1723,12 +1813,12 @@ def begin_trigger_rehydrate( ) -> LROPoller[None]: """rehydrate recovery point for restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Required. :type parameters: IO @@ -1759,12 +1849,12 @@ def begin_trigger_rehydrate( ) -> LROPoller[None]: """rehydrate recovery point for restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.dataprotection.models.AzureBackupRehydrationRequest or IO @@ -1786,12 +1876,14 @@ def begin_trigger_rehydrate( _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-12-01"] = 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_rehydrate_initial( # type: ignore resource_group_name=resource_group_name, @@ -1812,7 +1904,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: @@ -1824,9 +1916,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_trigger_rehydrate.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate"} # type: ignore + begin_trigger_rehydrate.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/rehydrate" + } def _trigger_restore_initial( self, @@ -1847,9 +1941,11 @@ def _trigger_restore_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1873,9 +1969,9 @@ def _trigger_restore_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 ) @@ -1902,7 +1998,9 @@ def _trigger_restore_initial( return deserialized - _trigger_restore_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore"} # type: ignore + _trigger_restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore" + } @overload def begin_trigger_restore( @@ -1917,7 +2015,7 @@ def begin_trigger_restore( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Triggers restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1957,7 +2055,7 @@ def begin_trigger_restore( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Triggers restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -1995,7 +2093,7 @@ def begin_trigger_restore( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Triggers restore for a BackupInstance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -2024,14 +2122,16 @@ def begin_trigger_restore( _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.OperationJobExtendedInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo] = 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_restore_initial( # type: ignore + raw_result = self._trigger_restore_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -2052,7 +2152,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: @@ -2064,9 +2164,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_trigger_restore.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore"} # type: ignore + begin_trigger_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/restore" + } def _resume_backups_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -2082,8 +2184,10 @@ def _resume_backups_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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_backups_request( resource_group_name=resource_group_name, @@ -2096,9 +2200,9 @@ def _resume_backups_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 ) @@ -2119,7 +2223,9 @@ def _resume_backups_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _resume_backups_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups"} # type: ignore + _resume_backups_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups" + } @distributed_trace def begin_resume_backups( @@ -2127,12 +2233,12 @@ def begin_resume_backups( ) -> LROPoller[None]: """This operation will resume backups for backup instance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2149,11 +2255,13 @@ def begin_resume_backups( _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-12-01"] = 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._resume_backups_initial( # type: ignore resource_group_name=resource_group_name, @@ -2172,7 +2280,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: @@ -2184,9 +2292,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_resume_backups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups"} # type: ignore + begin_resume_backups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeBackups" + } def _resume_protection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -2202,8 +2312,10 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement _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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_resume_protection_request( resource_group_name=resource_group_name, @@ -2216,9 +2328,9 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement 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 ) @@ -2239,7 +2351,9 @@ def _resume_protection_initial( # pylint: disable=inconsistent-return-statement if cls: return cls(pipeline_response, None, response_headers) - _resume_protection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection"} # type: ignore + _resume_protection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection" + } @distributed_trace def begin_resume_protection( @@ -2247,12 +2361,12 @@ def begin_resume_protection( ) -> LROPoller[None]: """This operation will resume protection for a stopped backup instance. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2269,11 +2383,13 @@ def begin_resume_protection( _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-12-01"] = 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._resume_protection_initial( # type: ignore resource_group_name=resource_group_name, @@ -2292,7 +2408,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: @@ -2304,9 +2420,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_resume_protection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection"} # type: ignore + begin_resume_protection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/resumeProtection" + } def _stop_protection_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -2322,8 +2440,10 @@ def _stop_protection_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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_stop_protection_request( resource_group_name=resource_group_name, @@ -2336,9 +2456,9 @@ def _stop_protection_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 ) @@ -2359,7 +2479,9 @@ def _stop_protection_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _stop_protection_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection"} # type: ignore + _stop_protection_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection" + } @distributed_trace def begin_stop_protection( @@ -2367,12 +2489,12 @@ def begin_stop_protection( ) -> LROPoller[None]: """This operation will stop protection of a backup instance and data will be held forever. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2389,11 +2511,13 @@ def begin_stop_protection( _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-12-01"] = 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._stop_protection_initial( # type: ignore resource_group_name=resource_group_name, @@ -2412,7 +2536,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: @@ -2424,9 +2548,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_stop_protection.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection"} # type: ignore + begin_stop_protection.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/stopProtection" + } def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -2442,8 +2568,10 @@ def _suspend_backups_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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_suspend_backups_request( resource_group_name=resource_group_name, @@ -2456,9 +2584,9 @@ def _suspend_backups_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 ) @@ -2479,7 +2607,9 @@ def _suspend_backups_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _suspend_backups_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups"} # type: ignore + _suspend_backups_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups" + } @distributed_trace def begin_suspend_backups( @@ -2488,12 +2618,12 @@ def begin_suspend_backups( """This operation will stop backup for a backup instance and retains the backup data as per the policy (except latest Recovery point, which will be retained forever). - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. @@ -2510,11 +2640,13 @@ def begin_suspend_backups( _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-12-01"] = 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._suspend_backups_initial( # type: ignore resource_group_name=resource_group_name, @@ -2533,7 +2665,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: @@ -2545,9 +2677,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_suspend_backups.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups"} # type: ignore + begin_suspend_backups.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/suspendBackups" + } def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statements self, @@ -2568,9 +2702,11 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem _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-12-01"] = 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 @@ -2594,9 +2730,9 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem 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 ) @@ -2617,7 +2753,9 @@ def _sync_backup_instance_initial( # pylint: disable=inconsistent-return-statem if cls: return cls(pipeline_response, None, response_headers) - _sync_backup_instance_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync"} # type: ignore + _sync_backup_instance_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync" + } @overload def begin_sync_backup_instance( @@ -2633,12 +2771,12 @@ def begin_sync_backup_instance( """Sync backup instance again in case of failure This action will retry last failed operation and will bring backup instance to valid state. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Required. :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest @@ -2672,12 +2810,12 @@ def begin_sync_backup_instance( """Sync backup instance again in case of failure This action will retry last failed operation and will bring backup instance to valid state. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Required. :type parameters: IO @@ -2709,12 +2847,12 @@ def begin_sync_backup_instance( """Sync backup instance again in case of failure This action will retry last failed operation and will bring backup instance to valid state. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. :type vault_name: str - :param backup_instance_name: Required. + :param backup_instance_name: The name of the backup instance. Required. :type backup_instance_name: str :param parameters: Request body for operation. Is either a model type or a IO type. Required. :type parameters: ~azure.mgmt.dataprotection.models.SyncBackupInstanceRequest or IO @@ -2736,12 +2874,14 @@ def begin_sync_backup_instance( _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-12-01"] = 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._sync_backup_instance_initial( # type: ignore resource_group_name=resource_group_name, @@ -2762,7 +2902,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: @@ -2774,9 +2914,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_sync_backup_instance.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync"} # type: ignore + begin_sync_backup_instance.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/sync" + } def _validate_for_restore_initial( self, @@ -2797,9 +2939,11 @@ def _validate_for_restore_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -2823,9 +2967,9 @@ def _validate_for_restore_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 ) @@ -2852,7 +2996,9 @@ def _validate_for_restore_initial( return deserialized - _validate_for_restore_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore"} # type: ignore + _validate_for_restore_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore" + } @overload def begin_validate_for_restore( @@ -2867,7 +3013,7 @@ def begin_validate_for_restore( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Validates if Restore can be triggered for a DataSource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -2907,7 +3053,7 @@ def begin_validate_for_restore( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Validates if Restore can be triggered for a DataSource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -2945,7 +3091,7 @@ def begin_validate_for_restore( ) -> LROPoller[_models.OperationJobExtendedInfo]: """Validates if Restore can be triggered for a DataSource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -2974,14 +3120,16 @@ def begin_validate_for_restore( _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.OperationJobExtendedInfo] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-12-01"] = 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.OperationJobExtendedInfo] = 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._validate_for_restore_initial( # type: ignore + raw_result = self._validate_for_restore_initial( resource_group_name=resource_group_name, vault_name=vault_name, backup_instance_name=backup_instance_name, @@ -3002,7 +3150,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: @@ -3014,6 +3162,8 @@ 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_validate_for_restore.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore"} # type: ignore + begin_validate_for_restore.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/validateRestore" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py index 22ea2028deb7..7a582ddbe008 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_policies_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,7 +45,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,11 +55,13 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -71,7 +78,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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,12 +88,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_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") @@ -103,8 +112,8 @@ 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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -114,12 +123,14 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_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") @@ -138,7 +149,7 @@ 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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,12 +159,14 @@ def build_delete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_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") @@ -189,7 +202,7 @@ def list( ) -> Iterable["_models.BaseBackupPolicyResource"]: """Returns list of backup policies belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -204,8 +217,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.BaseBackupPolicyResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BaseBackupPolicyResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -228,16 +243,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -245,13 +267,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BaseBackupPolicyResourceList", 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 @@ -264,7 +286,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies" + } @distributed_trace def get( @@ -274,7 +298,7 @@ def get( Gets a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -297,8 +321,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.BaseBackupPolicyResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BaseBackupPolicyResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -311,9 +337,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 ) @@ -330,7 +356,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + } @overload def create_or_update( @@ -347,7 +375,7 @@ def create_or_update( Creates or Updates a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -380,7 +408,7 @@ def create_or_update( Creates or Updates a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -411,7 +439,7 @@ def create_or_update( Creates or Updates a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -439,9 +467,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.BaseBackupPolicyResource] + api_version: Literal["2022-12-01"] = 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.BaseBackupPolicyResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -465,9 +495,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 ) @@ -484,7 +514,9 @@ def create_or_update( return deserialized - create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -494,7 +526,7 @@ def delete( # pylint: disable=inconsistent-return-statements Deletes a backup policy belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -517,8 +549,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -531,9 +565,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 ) @@ -546,4 +580,6 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupPolicies/{backupPolicyName}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py index 1fafff55677a..fcd88737d710 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_operation_results_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vault_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]] @@ -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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,12 +55,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "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") @@ -91,7 +98,7 @@ def get( ) -> Optional[_models.BackupVaultResource]: """get. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -114,8 +121,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.BackupVaultResource]] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.BackupVaultResource]] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -128,9 +137,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 ) @@ -157,4 +166,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationResults/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py index b6f194921f22..6c6624866954 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_backup_vaults_operations.py @@ -6,8 +6,9 @@ # 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, cast, overload -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,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]] @@ -42,7 +47,7 @@ def build_get_in_subscription_request(subscription_id: str, **kwargs: Any) -> Ht _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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +56,7 @@ def build_get_in_subscription_request(subscription_id: str, **kwargs: Any) -> Ht "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") @@ -66,7 +71,7 @@ def build_get_in_resource_group_request(resource_group_name: str, subscription_i _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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -75,11 +80,13 @@ def build_get_in_resource_group_request(resource_group_name: str, subscription_i "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -94,7 +101,7 @@ def build_get_request(resource_group_name: str, vault_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -104,11 +111,13 @@ def build_get_request(resource_group_name: str, vault_name: str, subscription_id ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -125,8 +134,8 @@ 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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,11 +145,13 @@ def build_create_or_update_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -157,7 +168,7 @@ def build_delete_request(resource_group_name: str, vault_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 + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -167,11 +178,13 @@ def build_delete_request(resource_group_name: str, vault_name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -186,8 +199,8 @@ def build_update_request(resource_group_name: str, vault_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,11 +210,13 @@ def build_update_request(resource_group_name: str, vault_name: str, subscription ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -220,8 +235,8 @@ def build_check_name_availability_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -230,12 +245,14 @@ def build_check_name_availability_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "location": _SERIALIZER.url("location", location, "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") @@ -279,8 +296,10 @@ def get_in_subscription(self, **kwargs: Any) -> Iterable["_models.BackupVaultRes _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.BackupVaultResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -301,16 +320,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -318,13 +344,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupVaultResourceList", 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 @@ -337,13 +363,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults"} # type: ignore + get_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/backupVaults" + } @distributed_trace def get_in_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.BackupVaultResource"]: """Returns resource collection belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -354,8 +382,10 @@ def get_in_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iter _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.BackupVaultResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupVaultResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -377,16 +407,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -394,13 +431,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("BackupVaultResourceList", 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 @@ -413,13 +450,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_in_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults"} # type: ignore + get_in_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults" + } @distributed_trace def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _models.BackupVaultResource: """Returns a resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -440,8 +479,10 @@ def get(self, resource_group_name: str, vault_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.BackupVaultResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.BackupVaultResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -453,9 +494,9 @@ def get(self, resource_group_name: str, vault_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 ) @@ -472,7 +513,9 @@ def get(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> _mode return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } def _create_or_update_initial( self, @@ -492,9 +535,11 @@ def _create_or_update_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.BackupVaultResource] + api_version: Literal["2022-12-01"] = 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.BackupVaultResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -517,9 +562,9 @@ def _create_or_update_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 ) @@ -536,11 +581,13 @@ def _create_or_update_initial( deserialized = self._deserialize("BackupVaultResource", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - _create_or_update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + _create_or_update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } @overload def begin_create_or_update( @@ -554,7 +601,7 @@ def begin_create_or_update( ) -> LROPoller[_models.BackupVaultResource]: """Creates or updates a BackupVault resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -590,7 +637,7 @@ def begin_create_or_update( ) -> LROPoller[_models.BackupVaultResource]: """Creates or updates a BackupVault resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -624,7 +671,7 @@ def begin_create_or_update( ) -> LROPoller[_models.BackupVaultResource]: """Creates or updates a BackupVault resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -650,14 +697,16 @@ def begin_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.BackupVaultResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-12-01"] = 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.BackupVaultResource] = 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._create_or_update_initial( # type: ignore + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, @@ -677,7 +726,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: @@ -689,9 +738,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_create_or_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + begin_create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -699,7 +750,7 @@ def delete( # pylint: disable=inconsistent-return-statements ) -> None: """Deletes a BackupVault resource from the resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -720,8 +771,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -733,9 +786,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 ) @@ -748,7 +801,9 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } def _update_initial( self, @@ -768,9 +823,11 @@ def _update_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[Optional[_models.BackupVaultResource]] + api_version: Literal["2022-12-01"] = 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.BackupVaultResource]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -793,9 +850,9 @@ def _update_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 ) @@ -814,7 +871,9 @@ def _update_initial( return deserialized - _update_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + _update_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } @overload def begin_update( @@ -829,7 +888,7 @@ def begin_update( """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -866,7 +925,7 @@ def begin_update( """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -901,7 +960,7 @@ def begin_update( """Updates a BackupVault resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -927,14 +986,16 @@ def begin_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.BackupVaultResource] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-12-01"] = 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.BackupVaultResource] = 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._update_initial( # type: ignore + raw_result = self._update_initial( resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, @@ -954,7 +1015,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: @@ -966,9 +1027,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_update.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}"} # type: ignore + begin_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}" + } @overload def check_name_availability( @@ -984,7 +1047,7 @@ def check_name_availability( API to check for resource name availability. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The location in which uniqueness will be verified. Required. @@ -1014,7 +1077,7 @@ def check_name_availability( API to check for resource name availability. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The location in which uniqueness will be verified. Required. @@ -1042,7 +1105,7 @@ def check_name_availability( API to check for resource name availability. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param location: The location in which uniqueness will be verified. Required. @@ -1069,9 +1132,11 @@ def check_name_availability( _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.CheckNameAvailabilityResult] + api_version: Literal["2022-12-01"] = 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.CheckNameAvailabilityResult] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1094,9 +1159,9 @@ def check_name_availability( 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 ) @@ -1113,4 +1178,6 @@ def check_name_availability( return deserialized - check_name_availability.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability"} # type: ignore + check_name_availability.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/locations/{location}/checkNameAvailability" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py index a82198ee8114..267622bac5ac 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_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_check_feature_support_request(location: str, subscription_id: str, **k _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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + 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_check_feature_support_request(location: str, subscription_id: str, **k "location": _SERIALIZER.url("location", location, "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") @@ -163,9 +168,11 @@ def check_feature_support( _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.FeatureValidationResponseBase] + api_version: Literal["2022-12-01"] = 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.FeatureValidationResponseBase] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -187,9 +194,9 @@ def check_feature_support( 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 check_feature_support( return deserialized - check_feature_support.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport"} # type: ignore + check_feature_support.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/checkFeatureSupport" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py index 645f9aeb40c2..bad908c19784 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_data_protection_operations_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -29,6 +30,10 @@ from .._serialization import Serializer from .._vendor import _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,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,8 +93,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-12-01"] = 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,16 +116,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -126,13 +140,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 @@ -145,4 +159,4 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.DataProtection/operations"} # type: ignore + list.metadata = {"url": "/providers/Microsoft.DataProtection/operations"} diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py index 81b59c816d69..f5fd4664c314 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_deleted_backup_instances_operations.py @@ -6,8 +6,9 @@ # 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, Union, cast -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +32,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]] @@ -42,7 +47,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +57,13 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -73,7 +80,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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -83,12 +90,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -105,7 +114,7 @@ def build_undelete_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,12 +124,14 @@ def build_undelete_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -156,7 +167,7 @@ def list( ) -> Iterable["_models.DeletedBackupInstanceResource"]: """Gets deleted backup instances belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -171,8 +182,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.DeletedBackupInstanceResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DeletedBackupInstanceResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -195,16 +208,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -212,13 +232,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DeletedBackupInstanceResourceList", 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 @@ -231,7 +251,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances" + } @distributed_trace def get( @@ -239,7 +261,7 @@ def get( ) -> _models.DeletedBackupInstanceResource: """Gets a deleted backup instance with name in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -262,8 +284,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.DeletedBackupInstanceResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DeletedBackupInstanceResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -276,9 +300,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 ) @@ -295,7 +319,9 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}" + } def _undelete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, vault_name: str, backup_instance_name: str, **kwargs: Any @@ -311,8 +337,10 @@ def _undelete_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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_undelete_request( resource_group_name=resource_group_name, @@ -325,9 +353,9 @@ def _undelete_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 ) @@ -340,7 +368,9 @@ def _undelete_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - _undelete_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete"} # type: ignore + _undelete_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete" + } @distributed_trace def begin_undelete( @@ -348,7 +378,7 @@ def begin_undelete( ) -> LROPoller[None]: """undelete. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -370,11 +400,13 @@ def begin_undelete( _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-12-01"] = 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._undelete_initial( # type: ignore resource_group_name=resource_group_name, @@ -393,7 +425,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: @@ -405,6 +437,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_undelete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete"} # type: ignore + begin_undelete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/deletedBackupInstances/{backupInstanceName}/undelete" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py deleted file mode 100644 index f638be14b0a9..000000000000 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_dpp_resource_guard_proxy_operations.py +++ /dev/null @@ -1,722 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload -from urllib.parse import parse_qs, urljoin, urlparse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request, _format_url_section - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(resource_group_name: str, vault_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_put_request( - resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = 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] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_unlock_delete_request( - resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = 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] - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), - "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, "str"), - } - - _url = _format_url_section(_url, **path_format_arguments) - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class DppResourceGuardProxyOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.dataprotection.DataProtectionClient`'s - :attr:`dpp_resource_guard_proxy` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.ResourceGuardProxyBaseResource"]: - """list. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceGuardProxyBaseResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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] - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - else: - # make call to next link with the client's api-version - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", 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.method = "GET" - return request - - 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) - 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 - request, stream=False, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies"} # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """get. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[_models.ResourceGuardProxyBaseResource] - - request = build_get_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.get.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore - - @overload - def put( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: _models.ResourceGuardProxyBaseResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """put. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def put( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """put. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def put( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: Union[_models.ResourceGuardProxyBaseResource, IO], - **kwargs: Any - ) -> _models.ResourceGuardProxyBaseResource: - """put. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: ResourceGuardProxyBaseResource or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.ResourceGuardProxyBaseResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = 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] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ResourceGuardProxyBaseResource") - - request = build_put_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.put.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ResourceGuardProxyBaseResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, vault_name: str, resource_guard_proxy_name: str, **kwargs: Any - ) -> None: - """delete. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) # type: str - cls = kwargs.pop("cls", None) # type: ClsType[None] - - request = build_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - template_url=self.delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) - - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore - - @overload - def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: _models.UnlockDeleteRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """unlock_delete. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: IO, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """unlock_delete. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Required. - :type parameters: IO - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def unlock_delete( - self, - resource_group_name: str, - vault_name: str, - resource_guard_proxy_name: str, - parameters: Union[_models.UnlockDeleteRequest, IO], - **kwargs: Any - ) -> _models.UnlockDeleteResponse: - """unlock_delete. - - :param resource_group_name: The name of the resource group where the backup vault is present. - Required. - :type resource_group_name: str - :param vault_name: The name of the backup vault. Required. - :type vault_name: str - :param resource_guard_proxy_name: Required. - :type resource_guard_proxy_name: str - :param parameters: Request body for operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.UnlockDeleteRequest or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: UnlockDeleteResponse or the result of cls(response) - :rtype: ~azure.mgmt.dataprotection.models.UnlockDeleteResponse - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version = 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] - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "UnlockDeleteRequest") - - request = build_unlock_delete_request( - resource_group_name=resource_group_name, - vault_name=vault_name, - resource_guard_proxy_name=resource_guard_proxy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self.unlock_delete.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore - - pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise HttpResponseError(response=response, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UnlockDeleteResponse", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - unlock_delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py index 3b96bc806ad1..c203727eba25 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_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 ( @@ -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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,12 +55,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "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") @@ -93,7 +100,7 @@ def get( successful, then it also contains URL of a Blob and a SAS key to access the same. The blob contains exported jobs in JSON serialized format. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -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.ExportJobsResult]] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.ExportJobsResult]] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_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.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/operations/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py index 6baab11c9cde..0918561c355d 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_export_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, Union, cast 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]] @@ -42,7 +47,7 @@ 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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,11 +57,13 @@ def build_trigger_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -100,8 +107,10 @@ def _trigger_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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_trigger_request( resource_group_name=resource_group_name, @@ -113,9 +122,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 ) @@ -133,13 +142,15 @@ def _trigger_initial( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, response_headers) - _trigger_initial.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs"} # type: ignore + _trigger_initial.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs" + } @distributed_trace def begin_trigger(self, resource_group_name: str, vault_name: str, **kwargs: Any) -> LROPoller[None]: """Triggers export of jobs and returns an OperationID to track. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -159,11 +170,13 @@ def begin_trigger(self, resource_group_name: str, vault_name: str, **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[None] - polling = kwargs.pop("polling", True) # type: Union[bool, PollingMethod] + api_version: Literal["2022-12-01"] = 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._trigger_initial( # type: ignore resource_group_name=resource_group_name, @@ -181,9 +194,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": "location"}, **kwargs) - ) # type: PollingMethod + ) elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: @@ -195,6 +208,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.DataProtection/backupVaults/{vaultName}/exportBackupJobs"} # type: ignore + begin_trigger.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/exportBackupJobs" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py index e86cdc496442..87c141fb612a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_jobs_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,7 +45,7 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i _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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,11 +55,13 @@ def build_list_request(resource_group_name: str, vault_name: str, subscription_i ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "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") @@ -71,7 +78,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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,12 +88,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "jobId": _SERIALIZER.url("job_id", job_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,7 +131,7 @@ def list( ) -> Iterable["_models.AzureBackupJobResource"]: """Returns list of jobs belonging to a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -136,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.AzureBackupJobResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AzureBackupJobResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -160,16 +171,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -177,13 +195,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AzureBackupJobResourceList", 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,7 +214,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs" + } @distributed_trace def get( @@ -204,7 +224,7 @@ def get( ) -> _models.AzureBackupJobResource: """Gets a job with id in a backup vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -228,8 +248,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.AzureBackupJobResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AzureBackupJobResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -242,9 +264,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 ) @@ -261,4 +283,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupJobs/{jobId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py index 4870e11386a9..98d7ea9244a2 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_result_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_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 ( @@ -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(operation_id: str, location: 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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(operation_id: str, location: str, subscription_id: str, ** "location": _SERIALIZER.url("location", location, "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(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_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[Optional[_models.OperationJobExtendedInfo]] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[Optional[_models.OperationJobExtendedInfo]] = kwargs.pop("cls", None) request = build_get_request( operation_id=operation_id, @@ -121,9 +128,9 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_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 ) @@ -150,4 +157,6 @@ def get(self, operation_id: str, location: str, **kwargs: Any) -> Optional[_mode return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationResults/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py index 4d78549ae4cb..3104874534f4 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_backup_vault_context_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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -50,12 +55,14 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "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") @@ -93,7 +100,7 @@ def get( Gets the operation status for an operation over a BackupVault's context. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -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[_models.OperationResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_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 ) @@ -149,4 +158,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/operationStatus/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py index 35f3a5c6b441..b60c9a2050da 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_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(location: str, operation_id: str, subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop("api_version", _params.pop("api-version", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -52,7 +57,7 @@ def build_get_request(location: 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(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat _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.OperationResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( location=location, @@ -121,9 +128,9 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat 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,4 +147,6 @@ def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.Operat return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/locations/{location}/operationStatus/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py index baaed93e801e..00b07b0226dd 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_operation_status_resource_group_context_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(resource_group_name: str, operation_id: 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 + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -47,12 +52,14 @@ def build_get_request(resource_group_name: str, operation_id: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", 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") @@ -88,7 +95,7 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo Gets the operation status for an operation over a ResourceGroup's context. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param operation_id: Required. @@ -109,8 +116,10 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo _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.OperationResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.OperationResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -122,9 +131,9 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo 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 ) @@ -141,4 +150,6 @@ def get(self, resource_group_name: str, operation_id: str, **kwargs: Any) -> _mo return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/operationStatus/{operationId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py index 973323aa06c1..3bc95c2f190a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_recovery_points_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -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]] @@ -49,7 +54,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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,12 +64,14 @@ def build_list_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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,7 +97,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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,13 +107,15 @@ def build_get_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_name, "str"), "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") @@ -148,7 +157,7 @@ def list( ) -> Iterable["_models.AzureBackupRecoveryPointResource"]: """Returns a list of Recovery Points for a DataSource in a vault. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -169,8 +178,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.AzureBackupRecoveryPointResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AzureBackupRecoveryPointResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -196,16 +207,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -213,13 +231,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("AzureBackupRecoveryPointResourceList", 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 @@ -232,7 +250,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints"} # type: ignore + list.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints" + } @distributed_trace def get( @@ -245,7 +265,7 @@ def get( ) -> _models.AzureBackupRecoveryPointResource: """Gets a Recovery Point using recoveryPointId for a Datasource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -270,8 +290,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.AzureBackupRecoveryPointResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.AzureBackupRecoveryPointResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -285,9 +307,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 ) @@ -304,4 +326,6 @@ def get( return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/recoveryPoints/{recoveryPointId}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py index 339e165dc55d..a3a69ae17ad1 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_resource_guards_operations.py @@ -6,8 +6,9 @@ # 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 -from urllib.parse import parse_qs, urljoin, urlparse +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -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,7 +45,7 @@ def build_get_resources_in_subscription_request(subscription_id: str, **kwargs: _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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,7 +56,7 @@ def build_get_resources_in_subscription_request(subscription_id: str, **kwargs: "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") @@ -68,7 +73,7 @@ def build_get_resources_in_resource_group_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,10 +83,12 @@ def build_get_resources_in_resource_group_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), } - _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") @@ -98,8 +105,8 @@ 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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,12 +115,14 @@ def build_put_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -132,7 +141,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", "2022-09-01-preview")) # type: str + api_version: Literal["2022-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -141,12 +150,14 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -163,7 +174,7 @@ 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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -172,12 +183,14 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -194,8 +207,8 @@ def build_patch_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -204,12 +217,14 @@ def build_patch_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -228,7 +243,7 @@ def build_get_disable_soft_delete_requests_objects_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -237,12 +252,14 @@ def build_get_disable_soft_delete_requests_objects_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -259,7 +276,7 @@ def build_get_delete_resource_guard_proxy_requests_objects_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -268,12 +285,14 @@ def build_get_delete_resource_guard_proxy_requests_objects_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -290,7 +309,7 @@ def build_get_backup_security_pin_requests_objects_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -299,12 +318,14 @@ def build_get_backup_security_pin_requests_objects_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -321,7 +342,7 @@ def build_get_delete_protected_item_requests_objects_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -330,12 +351,14 @@ def build_get_delete_protected_item_requests_objects_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -352,7 +375,7 @@ def build_get_update_protection_policy_requests_objects_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -361,12 +384,14 @@ def build_get_update_protection_policy_requests_objects_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -383,7 +408,7 @@ def build_get_update_protected_item_requests_objects_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -392,12 +417,14 @@ def build_get_update_protected_item_requests_objects_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_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") @@ -414,7 +441,7 @@ def build_get_default_disable_soft_delete_requests_object_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -423,13 +450,15 @@ def build_get_default_disable_soft_delete_requests_object_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), "requestName": _SERIALIZER.url("request_name", request_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") @@ -446,7 +475,7 @@ def build_get_default_delete_resource_guard_proxy_requests_object_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -455,13 +484,15 @@ def build_get_default_delete_resource_guard_proxy_requests_object_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), "requestName": _SERIALIZER.url("request_name", request_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") @@ -478,7 +509,7 @@ def build_get_default_backup_security_pin_requests_object_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -487,13 +518,15 @@ def build_get_default_backup_security_pin_requests_object_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), "requestName": _SERIALIZER.url("request_name", request_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") @@ -510,7 +543,7 @@ def build_get_default_delete_protected_item_requests_object_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -519,13 +552,15 @@ def build_get_default_delete_protected_item_requests_object_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), "requestName": _SERIALIZER.url("request_name", request_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") @@ -542,7 +577,7 @@ def build_get_default_update_protection_policy_requests_object_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -551,13 +586,15 @@ def build_get_default_update_protection_policy_requests_object_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), "requestName": _SERIALIZER.url("request_name", request_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") @@ -574,7 +611,7 @@ def build_get_default_update_protected_item_requests_object_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -583,13 +620,15 @@ def build_get_default_update_protected_item_requests_object_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}", ) # pylint: disable=line-too-long path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGuardsName": _SERIALIZER.url("resource_guards_name", resource_guards_name, "str"), "requestName": _SERIALIZER.url("request_name", request_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") @@ -634,8 +673,10 @@ def get_resources_in_subscription(self, **kwargs: Any) -> Iterable["_models.Reso _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.ResourceGuardResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -656,16 +697,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -673,13 +721,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ResourceGuardResourceList", 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 @@ -692,7 +740,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_resources_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards"} # type: ignore + get_resources_in_subscription.metadata = { + "url": "/subscriptions/{subscriptionId}/providers/Microsoft.DataProtection/resourceGuards" + } @distributed_trace def get_resources_in_resource_group( @@ -702,7 +752,7 @@ def get_resources_in_resource_group( Returns ResourceGuards collection belonging to a ResourceGroup. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -714,8 +764,10 @@ def get_resources_in_resource_group( _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.ResourceGuardResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -737,16 +789,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -754,13 +813,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("ResourceGuardResourceList", 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 @@ -773,7 +832,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_resources_in_resource_group.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards"} # type: ignore + get_resources_in_resource_group.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards" + } @overload def put( @@ -789,7 +850,7 @@ def put( Creates or updates a ResourceGuard resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -819,7 +880,7 @@ def put( Creates or updates a ResourceGuard resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -847,7 +908,7 @@ def put( Creates or updates a ResourceGuard resource belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -873,9 +934,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.ResourceGuardResource] + api_version: Literal["2022-12-01"] = 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.ResourceGuardResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -898,9 +961,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 ) @@ -917,7 +980,9 @@ def put( return deserialized - put.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + put.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + } @distributed_trace def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any) -> _models.ResourceGuardResource: @@ -925,7 +990,7 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any Returns a ResourceGuard belonging to a resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -946,8 +1011,10 @@ def get(self, resource_group_name: str, resource_guards_name: str, **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.ResourceGuardResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.ResourceGuardResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, @@ -959,9 +1026,9 @@ def get(self, resource_group_name: str, resource_guards_name: str, **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 ) @@ -978,7 +1045,9 @@ def get(self, resource_group_name: str, resource_guards_name: str, **kwargs: Any return deserialized - get.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + } @distributed_trace def delete( # pylint: disable=inconsistent-return-statements @@ -988,7 +1057,7 @@ def delete( # pylint: disable=inconsistent-return-statements Deletes a ResourceGuard resource from the resource group. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -1009,8 +1078,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-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, @@ -1022,9 +1093,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 ) @@ -1037,14 +1108,16 @@ def delete( # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) - delete.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + } @overload def patch( self, resource_group_name: str, resource_guards_name: str, - parameters: _models.PatchResourceRequestInput, + parameters: _models.PatchResourceGuardInput, *, content_type: str = "application/json", **kwargs: Any @@ -1055,13 +1128,13 @@ def patch( Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. :type resource_guards_name: str :param parameters: Request body for operation. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str @@ -1087,7 +1160,7 @@ def patch( Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. @@ -1108,7 +1181,7 @@ def patch( self, resource_group_name: str, resource_guards_name: str, - parameters: Union[_models.PatchResourceRequestInput, IO], + parameters: Union[_models.PatchResourceGuardInput, IO], **kwargs: Any ) -> _models.ResourceGuardResource: """Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for @@ -1117,13 +1190,13 @@ def patch( Updates a ResourceGuard resource belonging to a resource group. For example, updating tags for a resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: The name of ResourceGuard. Required. :type resource_guards_name: str :param parameters: Request body for operation. Is either a model type or a IO type. Required. - :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceRequestInput or IO + :type parameters: ~azure.mgmt.dataprotection.models.PatchResourceGuardInput or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str @@ -1143,9 +1216,11 @@ def patch( _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.ResourceGuardResource] + api_version: Literal["2022-12-01"] = 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.ResourceGuardResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -1153,7 +1228,7 @@ def patch( if isinstance(parameters, (IO, bytes)): _content = parameters else: - _json = self._serialize.body(parameters, "PatchResourceRequestInput") + _json = self._serialize.body(parameters, "PatchResourceGuardInput") request = build_patch_request( resource_group_name=resource_group_name, @@ -1168,9 +1243,9 @@ def patch( 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 ) @@ -1187,7 +1262,9 @@ def patch( return deserialized - patch.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}"} # type: ignore + patch.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}" + } @distributed_trace def get_disable_soft_delete_requests_objects( @@ -1199,7 +1276,7 @@ def get_disable_soft_delete_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1212,8 +1289,10 @@ def get_disable_soft_delete_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1236,16 +1315,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1253,13 +1339,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -1272,7 +1358,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_disable_soft_delete_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests"} # type: ignore + get_disable_soft_delete_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests" + } @distributed_trace def get_delete_resource_guard_proxy_requests_objects( @@ -1284,7 +1372,7 @@ def get_delete_resource_guard_proxy_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1297,8 +1385,10 @@ def get_delete_resource_guard_proxy_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1321,16 +1411,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1338,13 +1435,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -1357,7 +1454,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_delete_resource_guard_proxy_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests"} # type: ignore + get_delete_resource_guard_proxy_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests" + } @distributed_trace def get_backup_security_pin_requests_objects( @@ -1369,7 +1468,7 @@ def get_backup_security_pin_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1382,8 +1481,10 @@ def get_backup_security_pin_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1406,16 +1507,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1423,13 +1531,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -1442,7 +1550,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_backup_security_pin_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests"} # type: ignore + get_backup_security_pin_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests" + } @distributed_trace def get_delete_protected_item_requests_objects( @@ -1454,7 +1564,7 @@ def get_delete_protected_item_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1467,8 +1577,10 @@ def get_delete_protected_item_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1491,16 +1603,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1508,13 +1627,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -1527,7 +1646,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_delete_protected_item_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests"} # type: ignore + get_delete_protected_item_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests" + } @distributed_trace def get_update_protection_policy_requests_objects( @@ -1539,7 +1660,7 @@ def get_update_protection_policy_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1552,8 +1673,10 @@ def get_update_protection_policy_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1576,16 +1699,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1593,13 +1723,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -1612,7 +1742,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_update_protection_policy_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests"} # type: ignore + get_update_protection_policy_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests" + } @distributed_trace def get_update_protected_item_requests_objects( @@ -1624,7 +1756,7 @@ def get_update_protected_item_requests_objects( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1637,8 +1769,10 @@ def get_update_protected_item_requests_objects( _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.DppBaseResourceList] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResourceList] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, @@ -1661,16 +1795,23 @@ 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 - _parsed_next_link = urlparse(next_link) - _next_request_params = case_insensitive_dict(parse_qs(_parsed_next_link.query)) + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest("GET", urljoin(next_link, _parsed_next_link.path), params=_next_request_params) + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) request = _convert_request(request) - request.url = self._client.format_url(request.url) # type: ignore + request.url = self._client.format_url(request.url) request.method = "GET" return request @@ -1678,13 +1819,13 @@ def extract_data(pipeline_response): deserialized = self._deserialize("DppBaseResourceList", 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 @@ -1697,7 +1838,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - get_update_protected_item_requests_objects.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests"} # type: ignore + get_update_protected_item_requests_objects.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests" + } @distributed_trace def get_default_disable_soft_delete_requests_object( @@ -1709,7 +1852,7 @@ def get_default_disable_soft_delete_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1732,8 +1875,10 @@ def get_default_disable_soft_delete_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_disable_soft_delete_requests_object_request( resource_group_name=resource_group_name, @@ -1746,9 +1891,9 @@ def get_default_disable_soft_delete_requests_object( 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 ) @@ -1765,7 +1910,9 @@ def get_default_disable_soft_delete_requests_object( return deserialized - get_default_disable_soft_delete_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}"} # type: ignore + get_default_disable_soft_delete_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/disableSoftDeleteRequests/{requestName}" + } @distributed_trace def get_default_delete_resource_guard_proxy_requests_object( @@ -1777,7 +1924,7 @@ def get_default_delete_resource_guard_proxy_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1800,8 +1947,10 @@ def get_default_delete_resource_guard_proxy_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_resource_guard_proxy_requests_object_request( resource_group_name=resource_group_name, @@ -1814,9 +1963,9 @@ def get_default_delete_resource_guard_proxy_requests_object( 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 ) @@ -1833,7 +1982,9 @@ def get_default_delete_resource_guard_proxy_requests_object( return deserialized - get_default_delete_resource_guard_proxy_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}"} # type: ignore + get_default_delete_resource_guard_proxy_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteResourceGuardProxyRequests/{requestName}" + } @distributed_trace def get_default_backup_security_pin_requests_object( @@ -1845,7 +1996,7 @@ def get_default_backup_security_pin_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1868,8 +2019,10 @@ def get_default_backup_security_pin_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_backup_security_pin_requests_object_request( resource_group_name=resource_group_name, @@ -1882,9 +2035,9 @@ def get_default_backup_security_pin_requests_object( 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 ) @@ -1901,7 +2054,9 @@ def get_default_backup_security_pin_requests_object( return deserialized - get_default_backup_security_pin_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}"} # type: ignore + get_default_backup_security_pin_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/getBackupSecurityPINRequests/{requestName}" + } @distributed_trace def get_default_delete_protected_item_requests_object( @@ -1913,7 +2068,7 @@ def get_default_delete_protected_item_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -1936,8 +2091,10 @@ def get_default_delete_protected_item_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_delete_protected_item_requests_object_request( resource_group_name=resource_group_name, @@ -1950,9 +2107,9 @@ def get_default_delete_protected_item_requests_object( 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 ) @@ -1969,7 +2126,9 @@ def get_default_delete_protected_item_requests_object( return deserialized - get_default_delete_protected_item_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}"} # type: ignore + get_default_delete_protected_item_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/deleteProtectedItemRequests/{requestName}" + } @distributed_trace def get_default_update_protection_policy_requests_object( @@ -1981,7 +2140,7 @@ def get_default_update_protection_policy_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -2004,8 +2163,10 @@ def get_default_update_protection_policy_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protection_policy_requests_object_request( resource_group_name=resource_group_name, @@ -2018,9 +2179,9 @@ def get_default_update_protection_policy_requests_object( 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 ) @@ -2037,7 +2198,9 @@ def get_default_update_protection_policy_requests_object( return deserialized - get_default_update_protection_policy_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}"} # type: ignore + get_default_update_protection_policy_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectionPolicyRequests/{requestName}" + } @distributed_trace def get_default_update_protected_item_requests_object( @@ -2049,7 +2212,7 @@ def get_default_update_protected_item_requests_object( Returns collection of operation request objects for a critical operation protected by the given ResourceGuard resource. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param resource_guards_name: Required. @@ -2072,8 +2235,10 @@ def get_default_update_protected_item_requests_object( _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.DppBaseResource] + api_version: Literal["2022-12-01"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.DppBaseResource] = kwargs.pop("cls", None) request = build_get_default_update_protected_item_requests_object_request( resource_group_name=resource_group_name, @@ -2086,9 +2251,9 @@ def get_default_update_protected_item_requests_object( 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 ) @@ -2105,4 +2270,6 @@ def get_default_update_protected_item_requests_object( return deserialized - get_default_update_protected_item_requests_object.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}"} # type: ignore + get_default_update_protected_item_requests_object.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/resourceGuards/{resourceGuardsName}/updateProtectedItemRequests/{requestName}" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py index 7acf0bb5ab8a..7fbd11b5325a 100644 --- a/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_operations.py +++ b/sdk/dataprotection/azure-mgmt-dataprotection/azure/mgmt/dataprotection/operations/_restorable_time_ranges_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]] @@ -40,8 +45,8 @@ def build_find_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-12-01"] = kwargs.pop("api_version", _params.pop("api-version", "2022-12-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -51,12 +56,14 @@ def build_find_request( ) # pylint: disable=line-too-long path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), "vaultName": _SERIALIZER.url("vault_name", vault_name, "str"), "backupInstanceName": _SERIALIZER.url("backup_instance_name", backup_instance_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") @@ -101,7 +108,7 @@ def find( ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: """find. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -132,7 +139,7 @@ def find( ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: """find. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -161,7 +168,7 @@ def find( ) -> _models.AzureBackupFindRestorableTimeRangesResponseResource: """find. - :param resource_group_name: The name of the resource group where the backup vault is present. + :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param vault_name: The name of the backup vault. Required. @@ -190,9 +197,11 @@ def find( _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.AzureBackupFindRestorableTimeRangesResponseResource] + api_version: Literal["2022-12-01"] = 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.AzureBackupFindRestorableTimeRangesResponseResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -216,9 +225,9 @@ def find( 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,4 +244,6 @@ def find( return deserialized - find.metadata = {"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges"} # type: ignore + find.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataProtection/backupVaults/{vaultName}/backupInstances/{backupInstanceName}/findRestorableTimeRanges" + } diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.py new file mode 100644 index 000000000000..8161f70c8f0f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/check_backup_vaults_name_availability.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python check_backup_vaults_name_availability.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.check_name_availability( + resource_group_name="SampleResourceGroup", + location="westus", + parameters={"name": "swaggerExample", "type": "Microsoft.DataProtection/BackupVaults"}, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/CheckBackupVaultsNameAvailability.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.py new file mode 100644 index 000000000000..f49d523795bd --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/checkfeature_support.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python checkfeature_support.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.data_protection.check_feature_support( + location="WestUS", + parameters={"featureType": "DataSourceType", "objectType": "FeatureValidationRequest"}, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/CheckfeatureSupport.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py new file mode 100644 index 000000000000..ba1458398e3b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/create_or_update_backup_policy.py @@ -0,0 +1,97 @@ +# 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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python create_or_update_backup_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_policies.create_or_update( + resource_group_name="000pikumar", + vault_name="PrivatePreviewVault", + backup_policy_name="OSSDBPolicy", + parameters={ + "properties": { + "datasourceTypes": ["OssDB"], + "objectType": "BackupPolicy", + "policyRules": [ + { + "backupParameters": {"backupType": "Full", "objectType": "AzureBackupParams"}, + "dataStore": {"dataStoreType": "VaultStore", "objectType": "DataStoreInfoBase"}, + "name": "BackupWeekly", + "objectType": "AzureBackupRule", + "trigger": { + "objectType": "ScheduleBasedTriggerContext", + "schedule": {"repeatingTimeIntervals": ["R/2019-11-20T08:00:00-08:00/P1W"]}, + "taggingCriteria": [ + {"isDefault": True, "tagInfo": {"tagName": "Default"}, "taggingPriority": 99}, + { + "criteria": [ + { + "daysOfTheWeek": ["Sunday"], + "objectType": "ScheduleBasedBackupCriteria", + "scheduleTimes": ["2019-03-01T13:00:00Z"], + } + ], + "isDefault": False, + "tagInfo": {"tagName": "Weekly"}, + "taggingPriority": 20, + }, + ], + }, + }, + { + "isDefault": True, + "lifecycles": [ + { + "deleteAfter": {"duration": "P1W", "objectType": "AbsoluteDeleteOption"}, + "sourceDataStore": {"dataStoreType": "VaultStore", "objectType": "DataStoreInfoBase"}, + } + ], + "name": "Default", + "objectType": "AzureRetentionRule", + }, + { + "isDefault": False, + "lifecycles": [ + { + "deleteAfter": {"duration": "P12W", "objectType": "AbsoluteDeleteOption"}, + "sourceDataStore": {"dataStoreType": "VaultStore", "objectType": "DataStoreInfoBase"}, + } + ], + "name": "Weekly", + "objectType": "AzureRetentionRule", + }, + ], + } + }, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/PolicyCRUD/CreateOrUpdateBackupPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.py new file mode 100644 index 000000000000..6bb237b41c08 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_instance.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python delete_backup_instance.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_delete( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/DeleteBackupInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_policy.py new file mode 100644 index 000000000000..4cc18f714007 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python delete_backup_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_policies.delete( + resource_group_name="000pikumar", + vault_name="PrivatePreviewVault", + backup_policy_name="OSSDBPolicy", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/PolicyCRUD/DeleteBackupPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.py new file mode 100644 index 000000000000..a05de872eccb --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_backup_vault.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python delete_backup_vault.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.delete( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/DeleteBackupVault.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.py new file mode 100644 index 000000000000..b5cc3993dd5e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/delete_resource_guard.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python delete_resource_guard.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.delete( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/DeleteResourceGuard.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.py new file mode 100644 index 000000000000..ec4f7b481188 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/find_restorable_time_ranges.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python find_restorable_time_ranges.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.restorable_time_ranges.find( + resource_group_name="Blob-Backup", + vault_name="ZBlobBackupVaultBVTD3", + backup_instance_name="zblobbackuptestsa58", + parameters={ + "endTime": "2021-02-24T00:35:17.6829685Z", + "sourceDataStoreType": "OperationalStore", + "startTime": "2020-10-17T23:28:17.6829685Z", + }, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/FindRestorableTimeRanges.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.py new file mode 100644 index 000000000000..77271775ff67 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_instance.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.get( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/GetBackupInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_operation_result.py new file mode 100644 index 000000000000..0f9adc49b940 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_instance_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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_instance_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.get_backup_instance_operation_result( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + backup_instance_name="testInstance1", + operation_id="YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/GetBackupInstanceOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_policy.py new file mode 100644 index 000000000000..fd04c7380994 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_policies.get( + resource_group_name="000pikumar", + vault_name="PrivatePreviewVault", + backup_policy_name="OSSDBPolicy", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/PolicyCRUD/GetBackupPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.py new file mode 100644 index 000000000000..1f9be639d81f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_vault.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.get( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/GetBackupVault.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.py new file mode 100644 index 000000000000..47a5a85cc0ed --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vault_with_msi.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_vault_with_msi.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.get( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/GetBackupVaultWithMSI.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.py new file mode 100644 index 000000000000..532d4c7908aa --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_resource_group.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_vaults_in_resource_group.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.get_in_resource_group( + resource_group_name="SampleResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/GetBackupVaultsInResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.py new file mode 100644 index 000000000000..c1e4da71cb48 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_backup_vaults_in_subscription.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_backup_vaults_in_subscription.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.get_in_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/GetBackupVaultsInSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.py new file mode 100644 index 000000000000..6cd5e9578ad8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_backup_security_pin_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_default_backup_security_pin_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_default_backup_security_pin_requests_object( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + request_name="default", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetDefaultBackupSecurityPINRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.py new file mode 100644 index 000000000000..fdaef6b4a5c8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_protected_item_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_default_delete_protected_item_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_default_delete_protected_item_requests_object( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + request_name="default", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetDefaultDeleteProtectedItemRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.py new file mode 100644 index 000000000000..0bdb3ee38671 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_delete_resource_guard_proxy_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_default_delete_resource_guard_proxy_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_default_delete_resource_guard_proxy_requests_object( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + request_name="default", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetDefaultDeleteResourceGuardProxyRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.py new file mode 100644 index 000000000000..98114c31c2ce --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_disable_soft_delete_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_default_disable_soft_delete_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_default_disable_soft_delete_requests_object( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + request_name="default", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetDefaultDisableSoftDeleteRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.py new file mode 100644 index 000000000000..3479b34e3721 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protected_item_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_default_update_protected_item_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_default_update_protected_item_requests_object( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + request_name="default", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectedItemRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.py new file mode 100644 index 000000000000..5083313d2d4f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_default_update_protection_policy_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_default_update_protection_policy_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_default_update_protection_policy_requests_object( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + request_name="default", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetDefaultUpdateProtectionPolicyRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.py new file mode 100644 index 000000000000..333934ad50a5 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_deleted_backup_instance.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_deleted_backup_instance.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.deleted_backup_instances.get( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/DeletedBackupInstanceOperations/GetDeletedBackupInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_export_jobs_operation_result.py new file mode 100644 index 000000000000..e0b11093f065 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.export_jobs_operation_result.get( + resource_group_name="SwaggerTestRg", + vault_name="NetSDKTestRsVault", + operation_id="00000000-0000-0000-0000-000000000000", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/JobCRUD/GetExportJobsOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_job.py new file mode 100644 index 000000000000..5df461c8dff6 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="62b829ee-7936-40c9-a1c9-47a93f9f3965", + ) + + response = client.jobs.get( + resource_group_name="BugBash1", + vault_name="BugBashVaultForCCYv11", + job_id="3c60cb49-63e8-4b21-b9bd-26277b3fdfae", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/JobCRUD/GetJob.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.py new file mode 100644 index 000000000000..536f34fd6250 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.operation_result.get( + operation_id="MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", + location="WestUS", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/GetOperationResult.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_patch.py new file mode 100644 index 000000000000..48a585f92a4e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_result_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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_operation_result_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_vault_operation_results.get( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + operation_id="YWUzNDFkMzQtZmM5OS00MmUyLWEzNDMtZGJkMDIxZjlmZjgzOzdmYzBiMzhmLTc2NmItNDM5NS05OWQ1LTVmOGEzNzg4MWQzNA==", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/GetOperationResultPatch.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.py new file mode 100644 index 000000000000..991bb0be11a7 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.operation_status.get( + location="WestUS", + operation_id="MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/GetOperationStatus.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.py new file mode 100644 index 000000000000..b4e5839eb91c --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_rg_context.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_operation_status_rg_context.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.operation_status_resource_group_context.get( + resource_group_name="SampleResourceGroup", + operation_id="MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/GetOperationStatusRGContext.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.py new file mode 100644 index 000000000000..f0bcbe5d2853 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_operation_status_vault_context.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_operation_status_vault_context.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.operation_status_backup_vault_context.get( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + operation_id="MjkxOTMyODMtYTE3My00YzJjLTg5NjctN2E4MDIxNDA3NjA2OzdjNGE2ZWRjLWJjMmItNDRkYi1hYzMzLWY1YzEwNzk5Y2EyOA==", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/GetOperationStatusVaultContext.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.py new file mode 100644 index 000000000000..a93eef3851ce --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_recovery_point.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_recovery_point.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.recovery_points.get( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + recovery_point_id="7fb2cddd-c5b3-44f6-a0d9-db3c4f9d5f25", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/GetRecoveryPoint.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.py new file mode 100644 index 000000000000..a86c0bdfcaff --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guard.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_resource_guard.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetResourceGuard.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.py new file mode 100644 index 000000000000..324e4c790266 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_resource_group.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_resource_guards_in_resource_group.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_resources_in_resource_group( + resource_group_name="SampleResourceGroup", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetResourceGuardsInResourceGroup.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.py new file mode 100644 index 000000000000..c67416507f78 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/get_resource_guards_in_subscription.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python get_resource_guards_in_subscription.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_resources_in_subscription() + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/GetResourceGuardsInSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.py new file mode 100644 index 000000000000..828f370a8eda --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python 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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.data_protection_operations.list() + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/Operations/List.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.py new file mode 100644 index 000000000000..35e285f2f718 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_instances.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_backup_instances.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.list( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/ListBackupInstances.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_policy.py new file mode 100644 index 000000000000..c81d4938bea2 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_backup_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_policies.list( + resource_group_name="000pikumar", + vault_name="PrivatePreviewVault", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/PolicyCRUD/ListBackupPolicy.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.py new file mode 100644 index 000000000000..4c8630978a20 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_backup_security_pin_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_backup_security_pin_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_backup_security_pin_requests_objects( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/ListBackupSecurityPINRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.py new file mode 100644 index 000000000000..8c687ef66520 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_protected_item_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_delete_protected_item_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_delete_protected_item_requests_objects( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/ListDeleteProtectedItemRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.py new file mode 100644 index 000000000000..74631cb22018 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_delete_resource_guard_proxy_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_delete_resource_guard_proxy_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_delete_resource_guard_proxy_requests_objects( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/ListDeleteResourceGuardProxyRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.py new file mode 100644 index 000000000000..70287814e408 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_deleted_backup_instances.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_deleted_backup_instances.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.deleted_backup_instances.list( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/DeletedBackupInstanceOperations/ListDeletedBackupInstances.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.py new file mode 100644 index 000000000000..6c4bc1e6b048 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_disable_soft_delete_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_disable_soft_delete_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_disable_soft_delete_requests_objects( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/ListDisableSoftDeleteRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_jobs.py new file mode 100644 index 000000000000..f28069c525a1 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# 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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="62b829ee-7936-40c9-a1c9-47a93f9f3965", + ) + + response = client.jobs.list( + resource_group_name="BugBash1", + vault_name="BugBashVaultForCCYv11", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/JobCRUD/ListJobs.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.py new file mode 100644 index 000000000000..dc9241282a3b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_recovery_points.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_recovery_points.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.recovery_points.list( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/ListRecoveryPoints.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.py new file mode 100644 index 000000000000..7287a5feeb36 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protected_item_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_update_protected_item_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_update_protected_item_requests_objects( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/ListUpdateProtectedItemRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.py new file mode 100644 index 000000000000..4752d9122b26 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/list_update_protection_policy_requests.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python list_update_protection_policy_requests.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.get_update_protection_policy_requests_objects( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/ListUpdateProtectionPolicyRequests.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.py new file mode 100644 index 000000000000..21d56932683f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_backup_vault.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python patch_backup_vault.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.begin_update( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + parameters={ + "properties": {"monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "Enabled"}}}, + "tags": {"newKey": "newVal"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/PatchBackupVault.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.py new file mode 100644 index 000000000000..bcd9b975ea8d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/patch_resource_guard.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python patch_resource_guard.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.patch( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + parameters={"tags": {"newKey": "newVal"}}, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/PatchResourceGuard.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.py new file mode 100644 index 000000000000..8c59b698792b --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_instance.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_backup_instance.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_create_or_update( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "properties": { + "dataSourceInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + "resourceLocation": "", + "resourceName": "testdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "dataSourceSetInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "datasourceAuthCredentials": { + "objectType": "SecretStoreBasedAuthCredentials", + "secretStoreResource": { + "secretStoreType": "AzureKeyVault", + "uri": "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + "friendlyName": "harshitbi2", + "objectType": "BackupInstance", + "policyInfo": { + "policyId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1", + "policyParameters": { + "dataStoreParametersList": [ + { + "dataStoreType": "OperationalStore", + "objectType": "AzureOperationalStoreParameters", + "resourceGroupId": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest", + } + ] + }, + }, + "validationType": "ShallowValidation", + }, + "tags": {"key1": "val1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/PutBackupInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.py new file mode 100644 index 000000000000..f5cc460f02b7 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_backup_vault.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.begin_create_or_update( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + parameters={ + "identity": {"type": "None"}, + "location": "WestUS", + "properties": { + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "Enabled"}}, + "storageSettings": [{"datastoreType": "VaultStore", "type": "LocallyRedundant"}], + }, + "tags": {"key1": "val1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/PutBackupVault.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.py new file mode 100644 index 000000000000..37ccd7202c2f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_backup_vault_with_msi.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_backup_vault_with_msi.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.backup_vaults.begin_create_or_update( + resource_group_name="SampleResourceGroup", + vault_name="swaggerExample", + parameters={ + "identity": {"type": "systemAssigned"}, + "location": "WestUS", + "properties": { + "monitoringSettings": {"azureMonitorAlertSettings": {"alertsForAllJobFailures": "Enabled"}}, + "storageSettings": [{"datastoreType": "VaultStore", "type": "LocallyRedundant"}], + }, + "tags": {"key1": "val1"}, + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/VaultCRUD/PutBackupVaultWithMSI.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.py new file mode 100644 index 000000000000..7da7f3d4ced5 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/put_resource_guard.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python put_resource_guard.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="0b352192-dcac-4cc7-992e-a96190ccc68c", + ) + + response = client.resource_guards.put( + resource_group_name="SampleResourceGroup", + resource_guards_name="swaggerExample", + parameters={"location": "WestUS", "tags": {"key1": "val1"}}, + ) + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/ResourceGuardCRUD/PutResourceGuard.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.py new file mode 100644 index 000000000000..5ebda3dac53e --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_backups.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python resume_backups.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_resume_backups( + resource_group_name="testrg", + vault_name="testvault", + backup_instance_name="testbi", + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/ResumeBackups.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.py new file mode 100644 index 000000000000..f3ee9d532289 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/resume_protection.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python resume_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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_resume_protection( + resource_group_name="testrg", + vault_name="testvault", + backup_instance_name="testbi", + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/ResumeProtection.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.py new file mode 100644 index 000000000000..b642ab39a24d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/stop_protection.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# 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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_stop_protection( + resource_group_name="testrg", + vault_name="testvault", + backup_instance_name="testbi", + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/StopProtection.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.py new file mode 100644 index 000000000000..0dc5e3df4235 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/suspend_backups.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python suspend_backups.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_suspend_backups( + resource_group_name="testrg", + vault_name="testvault", + backup_instance_name="testbi", + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/SuspendBackups.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.py new file mode 100644 index 000000000000..c4f21b53cfe1 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/sync_backup_instance.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python sync_backup_instance.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_sync_backup_instance( + resource_group_name="testrg", + vault_name="testvault", + backup_instance_name="testbi", + parameters={"syncType": "Default"}, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/SyncBackupInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.py new file mode 100644 index 000000000000..e068d5526eae --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_backup.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python trigger_backup.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_adhoc_backup( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "backupRuleOptions": {"ruleName": "BackupWeekly", "triggerOption": {"retentionTagOverride": "yearly"}} + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/TriggerBackup.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_export_jobs.py new file mode 100644 index 000000000000..47be21d3590f --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# 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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.export_jobs.begin_trigger( + resource_group_name="SwaggerTestRg", + vault_name="NetSDKTestRsVault", + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/JobCRUD/TriggerExportJobs.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.py new file mode 100644 index 000000000000..2ed26ebd50e7 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_rehydrate.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python trigger_rehydrate.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_trigger_rehydrate( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "recoveryPointId": "hardcodedRP", + "rehydrationPriority": "High", + "rehydrationRetentionDuration": "7D", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/TriggerRehydrate.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py new file mode 100644 index 000000000000..aeef15324e12 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore.py @@ -0,0 +1,78 @@ +# 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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python trigger_restore.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_trigger_restore( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "objectType": "AzureBackupRecoveryPointBasedRestoreRequest", + "recoveryPointId": "hardcodedRP", + "restoreTargetInfo": { + "datasourceAuthCredentials": { + "objectType": "SecretStoreBasedAuthCredentials", + "secretStoreResource": { + "secretStoreType": "AzureKeyVault", + "uri": "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + "datasourceInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + "resourceLocation": "", + "resourceName": "targetdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "datasourceSetInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "objectType": "RestoreTargetInfo", + "recoveryOption": "FailIfExists", + "restoreLocation": "southeastasia", + }, + "sourceDataStoreType": "VaultStore", + "sourceResourceId": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/TriggerRestore.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py new file mode 100644 index 000000000000..9ac22dc7ab8d --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_as_files.py @@ -0,0 +1,58 @@ +# 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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python trigger_restore_as_files.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_trigger_restore( + resource_group_name="000pikumar", + vault_name="PrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "objectType": "AzureBackupRecoveryPointBasedRestoreRequest", + "recoveryPointId": "hardcodedRP", + "restoreTargetInfo": { + "objectType": "RestoreFilesTargetInfo", + "recoveryOption": "FailIfExists", + "restoreLocation": "southeastasia", + "targetDetails": { + "filePrefix": "restoredblob", + "restoreTargetLocationType": "AzureBlobs", + "url": "https://teststorage.blob.core.windows.net/restoretest", + }, + }, + "sourceDataStoreType": "VaultStore", + "sourceResourceId": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/TriggerRestoreAsFiles.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py new file mode 100644 index 000000000000..8fb8c27879d8 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/trigger_restore_with_rehydration.py @@ -0,0 +1,73 @@ +# 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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python trigger_restore_with_rehydration.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_trigger_restore( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "objectType": "AzureBackupRestoreWithRehydrationRequest", + "recoveryPointId": "hardcodedRP", + "rehydrationPriority": "High", + "rehydrationRetentionDuration": "7D", + "restoreTargetInfo": { + "datasourceInfo": { + "datasourceType": "OssDB", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + "resourceLocation": "", + "resourceName": "testdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "datasourceSetInfo": { + "datasourceType": "OssDB", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "objectType": "RestoreTargetInfo", + "recoveryOption": "FailIfExists", + "restoreLocation": "southeastasia", + }, + "sourceDataStoreType": "VaultStore", + "sourceResourceId": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/TriggerRestoreWithRehydration.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.py new file mode 100644 index 000000000000..9a36861b7589 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/undelete_deleted_backup_instance.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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python undelete_deleted_backup_instance.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.deleted_backup_instances.begin_undelete( + resource_group_name="testrg", + vault_name="testvault", + backup_instance_name="testbi", + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/DeletedBackupInstanceOperations/UndeleteDeletedBackupInstance.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py new file mode 100644 index 000000000000..9834b21b91e0 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_for_backup.py @@ -0,0 +1,75 @@ +# 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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python validate_for_backup.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_validate_for_backup( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + parameters={ + "backupInstance": { + "dataSourceInfo": { + "datasourceType": "OssDB", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + "resourceLocation": "", + "resourceName": "testdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "dataSourceSetInfo": { + "datasourceType": "OssDB", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "datasourceAuthCredentials": { + "objectType": "SecretStoreBasedAuthCredentials", + "secretStoreResource": { + "secretStoreType": "AzureKeyVault", + "uri": "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + "friendlyName": "harshitbi2", + "objectType": "BackupInstance", + "policyInfo": { + "policyId": "/subscriptions/04cf684a-d41f-4550-9f70-7708a3a2283b/resourceGroups/000pikumar/providers/Microsoft.DataProtection/Backupvaults/PratikPrivatePreviewVault1/backupPolicies/PratikPolicy1" + }, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/ValidateForBackup.json +if __name__ == "__main__": + main() diff --git a/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py new file mode 100644 index 000000000000..41e91fca7007 --- /dev/null +++ b/sdk/dataprotection/azure-mgmt-dataprotection/generated_samples/validate_restore.py @@ -0,0 +1,80 @@ +# 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.dataprotection import DataProtectionClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-dataprotection +# USAGE + python validate_restore.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 = DataProtectionClient( + credential=DefaultAzureCredential(), + subscription_id="04cf684a-d41f-4550-9f70-7708a3a2283b", + ) + + response = client.backup_instances.begin_validate_for_restore( + resource_group_name="000pikumar", + vault_name="PratikPrivatePreviewVault1", + backup_instance_name="testInstance1", + parameters={ + "restoreRequestObject": { + "objectType": "AzureBackupRecoveryPointBasedRestoreRequest", + "recoveryPointId": "hardcodedRP", + "restoreTargetInfo": { + "datasourceAuthCredentials": { + "objectType": "SecretStoreBasedAuthCredentials", + "secretStoreResource": { + "secretStoreType": "AzureKeyVault", + "uri": "https://samplevault.vault.azure.net/secrets/credentials", + }, + }, + "datasourceInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "Datasource", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/targetdb", + "resourceLocation": "", + "resourceName": "targetdb", + "resourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "resourceUri": "", + }, + "datasourceSetInfo": { + "datasourceType": "Microsoft.DBforPostgreSQL/servers/databases", + "objectType": "DatasourceSet", + "resourceID": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest", + "resourceLocation": "", + "resourceName": "viveksipgtest", + "resourceType": "Microsoft.DBforPostgreSQL/servers", + "resourceUri": "", + }, + "objectType": "RestoreTargetInfo", + "recoveryOption": "FailIfExists", + "restoreLocation": "southeastasia", + }, + "sourceDataStoreType": "VaultStore", + "sourceResourceId": "/subscriptions/f75d8d8b-6735-4697-82e1-1a7a3ff0d5d4/resourceGroups/viveksipgtest/providers/Microsoft.DBforPostgreSQL/servers/viveksipgtest/databases/testdb", + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/dataprotection/resource-manager/Microsoft.DataProtection/stable/2022-12-01/examples/BackupInstanceOperations/ValidateRestore.json +if __name__ == "__main__": + main()